How can I render a block in the sidebar in php? I'm using the Zen theme and I'm trying to keep as much in code as possible. I'm currently using context to render the block, but I like my php :)

I'm aware of 

$block = module_invoke('views', 'block_view', 'name_of_view_display');
print render($block);

// and this
$block = block_load('views', 'name_of_view-name_of_view_display');
$output = _block_get_renderable_array(_block_render_blocks(array($block)));


which works perfectly in most cases. My page.tpl file says

&lt;?php if ($sidebar_first || $sidebar_second): ?&gt;
  &lt;aside class="sidebars"&gt;
    &lt;?php print $sidebar_first; ?&gt;
    &lt;?php print $sidebar_second; ?&gt;
  &lt;/aside&gt;
&lt;?php endif; ?&gt;


So, clearly, my $sidebar_second variable is empty. I tried to render the block in a theme_preprocess_page function, adding the block to the $vars['page']['sidebar_second'] array, but no luck so far. 

Any ideas?

Thanks,
Brett
If you need to assign block to region programmatically you can implement hook_block_info_alter

function YOURMODULE_block_info_alter(&amp;$blocks, $theme, $code_blocks) {
  if (isset($blocks['views']['name_of_view-name_of_view_display'])) {
    // assign block to region
    $blocks['views']['name_of_view-name_of_view_display']['region'] = 'sidebar_second';
  }
}