Not long a ago, i have 2 posted about rendering Blocks and Views in PHP.
We can render the Drupal 7 block by PHP in another way.
1. Find out the block which you want to render from the db table called block.
2. You could see there are 2 columns, one is called module and the other is called delta. These 2 data are what we need to render the block programmatically.
3. Use the following piece of code to print the block in PHP.
<?php $block = block_load(<module>, <delta>); print render(_block_get_renderable_array( _block_render_blocks(array($block)))); ?>
The above method works even for block created by Views.
Done =)
Reference:
You rule
LikeLike
It doesn’t work for blocks created by ‘faceapi’ module…
LikeLike