Drupal tip: Programmatically output a block

The following PHP code will print out a block in Drupal 7:

$module = 'system';
$delta = 'main';

//Load the block object.
$block = block_load($module, $delta);

// Get a renderable array.
$render_array = _block_get_renderable_array(_block_render_blocks(array($block)));

// Render the block element.
$output = render($render_array);

print $output;

To locate $module and $delta, go to admin/structure/block and click on the "configure" link next to the block you want to print. The strings will be shown in the URL as such: admin/structure/block/manage/[module]/[delta]/configure.