Drupal 7 will consider "node" $content as a block region, which has advantages over the old "special" $content variable in Drupal 6.
Now since the $content is a block region, themer no longer needs to provide special region area in top / bottom of the node, a site builder just have to put the "top node" block in the content region and set it to be on top / bottom of the content block.
But how about if you want to "integrate" the content node block with other block region, like if you want to display a "node" content on left top while providing another custom region on the left bottom of the node while printing the rest of the node content on the right side??
Sounds complex? In drupal 6, we can achieve this by invoking
<?php
theme('blocks', 'your_block_region_machine_name');
?>Now in Drupal 7, theme_blocks is gone... so to achieve the same result we need to invoke this instead :
<?php
print render(block_get_blocks_by_region('your_block_region_machine_name'));
?>The better way to get this done in Drupal 7 is by invoking the function inside preprocess_node function like this :
<?php
function your_theme_name_preprocess_node(&$variables) {
if ($blocks = block_get_blocks_by_region('your_block_region_machine_name')) {
$variables['banner_space'] = $blocks;
}
}
?>Additional information provided by aquariumtap if you want to preprocess the block region directly from template.php instead of theme.info files :
aquariumtap :
If you want those blocks to be available to hook_preprocess_region, add a bit more information:
<?php
function your_theme_name_preprocess_node(&$variables) {
if ($blocks = block_get_blocks_by_region('your_block_region_machine_name')) {
$variables['banner_space'] = $blocks;
$variables['banner_space'] = $blocks;
$variables['banner_space']['#theme_wrappers'] = array('region');
$variables['banner_space']['#region'] = 'your_block_region_machine_name';
}
}
?>then invoke this function inside your node.tpl.php
1 | <?php print render($banner_space); ?> |
If you got better way to do this, please post it in your comment :)

Could you be so kind to show me how to put 2 or 3 blocks in bottom 1 region in Drupal 7 theme.
Adding this code in template.php
$variables['foo'] = block_get_blocks_by_region('your_block_region_machine_name');
?>and when rendering it in tpls (eg node.tpl)
print render($foo);
?>is optional and not required.
if you want to conditionally rendering you'll need to split the function :
$block_region = block_get_blocks_by_region('your_block_region_machine_name');
if (isset($block_region)) { // you'll need to double check the actual return value for the $block_region, this is just an example and it may not work
print render($block_region);
}
?>
ok it works but no need to add code in template.php ? your ways works but how can do this code conditionnaly rendered by php if region isnt empty ?
thanks
edit the theme .info to register your multiple custom block regions, then print each of the regions in the node.tpl (or other place) by invoking :
print render(block_get_blocks_by_region('your_block_region_machine_name'));
?>for each block region that you want to print

hi
how to do to have multiple regions in D7 , i've posted here : http://drupal.org/node/1232500
if someone could take a look to ..
thanks

hi
how to do to have multiple regions in D7 , i've posted here : http://drupal.org/node/1232500
if someone could take a look to ..
thanks
Thanks for providing the code, I was assuming people will create the regions from the theme.info files since they are capable to edit the template.php files.
But your code will provide user with more options that they can actually create a block region without the need to edit .info file.

If you want those blocks to be available to hook_preprocess_region, add a bit more information:
$variables['banner_space'] = $blocks;
$variables['banner_space']['#theme_wrappers'] = array('region');
$variables['banner_space']['#region'] = 'your_block_region_machine_name';

Wow!, this was a real quality post. In theory I'd like to write like this too - taking time and real effort to make a good article on Kosttillskott... but what can I say... I keep putting it off and never seem to get something done.
Sorry
Ooops sorry my mistake! Everything is ok!