I have created a block for adding image from drupal backend with title name "image". Now i want to add this block into page.tpl. How can i do that by using code.
1 Answer
Here is the sample code
$imageblock = block_load('block', '155');
$output = drupal_render(_block_get_renderable_array(_block_render_blocks(array($imageblock))));
$output will have the generate html for the block . This can be rendered in the template file using
print $output;
If the block is created using views, you may have to use $imageblock = block_load('views', 'block_name');
instead of loading the block using the block id.
admin/structure/block
. Read this, espacially the comments, if you really want to do it in code..