In Drupal 6, it was easy to insert a block into a template with the following code:
$block = module_invoke(\'views\', \'block\', \'view\', \'block_name\');
print
The module_invoke()
function works. However, I found that rendering a block this way apparently won't use a custom template for that block. This might be OK depending upon your needs.
As commented before in other answers, this works as well and also makes use of custom templates:
$raw_block = block_load('your-module', 'delta');
$rendered_block = drupal_render(_block_get_renderable_array(_block_render_blocks(array($raw_block))));
print $rendered_block;
So, if you have a custom block--your-module--delta.tpl.php
template file, it will be used to format the block.
Source: http://api.drupal.org/api/drupal/includes!module.inc/function/module_invoke/7