I used to have a 5.x theme with a block region defined inside node.tpl instead of page.tpl.
It gave me additional freedom of inserting blocks between main node content and secondary information like $links, $submitted, $terms

No I'm upgrading to 6.x and I can't make this work any more

I've defined regions in a new fashion, adding

regions[content_bottom] = ContentBottom

to my_theme.info


<?php print $content_bottom; ?>

to my node.tpl.php

The region shows in list at /admin/build/block (but not as a named visual block, as the rest - but this was the case in 5.x, I consider it an expected behavior)
and I can assign blocks to it, but they never show on any actual node-type pages.

So I'm confused - is that some problem with my setup or this possibility was removed in Drupal 6? Anyone did the same in Drupal 6? Any hints?


mean0dspt’s picture

ok, so I also had to put preprocessing like this:

THEMENAME_preprocess_node (&$vars) {
foreach (array('content_bottom') as $region) {
      $vars[$region] = theme('blocks', $region);
      return $vars;

then it works

Anandyrh’s picture

Hi, me also facing the same problem
please say me where to add this below code

THEMENAME_preprocess_node (&$vars) {
foreach (array('content_bottom') as $region) {
      $vars[$region] = theme('blocks', $region);
      return $vars;
junedkazi’s picture

you can add this piece of code to template.php .
Hope this link helps http://drupal.org/node/223430
This one http://drupal.org/node/337022 is for the nodes


Juned Kazi

Anandyrh’s picture

is this is right?

mokargas’s picture

I had serious problems with this snippet - for some reason Drupal drops respect to node ordering when I've added this, and while using custom blocks and module blocks. Removing the snippet returned ordering back to normal.

Instead I had to print theme('blocks', $region) in a particular node template (ie node-content_type.tpl.php) where I wanted the region.

Anandyrh’s picture

Is this correct to create a region in node-product.tpl.php?

This code in theme.info
regions[related_reports]= Related Report

This code in template.php

function greenNblack_preprocess_node(&$vars, $hook) {
  // Variables available to every node are defined here

  // Now define node type-specific variables by calling their own preprocess functions (if they exist)
  $function = 'greenNblack_preprocess_node'.'_'. $vars['node']->type;
  if (function_exists($function)) {

This code in node-product.tpl.php

<?php print $related_reports; ?>
Anandyrh’s picture


Thank's for you replay,
Problem was with my node.tpl file
Fixed it!

FL4PJ4CK’s picture

Could you tell us, which code you finally used in your template.php?

Jeff Burnz’s picture

The above convoluted methods are unnecessary:

function themeName_preprocess_node(&$vars, $hook) {
  $vars['custom_region'] = theme('blocks', 'custom_region');

Replace "themeName" with the name of your theme and "custom_region" with the machine name of your region.

FL4PJ4CK’s picture

Thank you for the quick answer. I tried this but it still doesn't appear anywhere in my node. I put this code at the end of my template.php:

function mw_preprocess_node(&$vars, $hook) {
$vars['below_content'] = theme('blocks', 'below_content');

(without the php-tags).
In my info-file I added this line:

regions[below_content] = below content

My node.tpl contains this:

print $below_content

And in my admin section I dropped the Fivestar-rating in the "below_content" region.

But this doesn't work...

Jeff Burnz’s picture

clear your cache, else you've done something, its how it works, done this a million times...

FL4PJ4CK’s picture

No idea what to do, I tried this now several times and nothing happens... I'll let you know when I get it to work. But thanks anyhow.

henrykuong’s picture

Really great! This is I need. thank all eveyone 4 shared !
[url=http://simulationempruntimmobilier.com/][color=#FFFFFF][u]calcul pret assurance simulation taux emprunt
immobilier[/u][/color][/url][color=#FFFFFF] - Taux emprunt immobilier. Comparez les offres d’emprunt immobilier, simulation emprunt immobilier, taux emprunt immobilier[/color][url=http://simulationempruntimmobilier.com/][color=#FFFFFF][u]calcul pret assurance simulation taux emprunt immobilier[/u][/color][/url]

bomarmonk’s picture

When I added my custom block region, all of the regular block regions vanished, leaving me with only my custom block region. Do I have to add every standard block region back into the template manually? Or is there an easier way? Any advice will be appreciated!

Jeff Burnz’s picture

In the info file if you declare one region, you must delcare them all, my guess is no regions were defined in your info file. In this case the defaults are used - header, footer, sidebars and content - you must re-declare all these if you declare even one of them or another custom region.

this is in the theming docs, please read the theme docs before posting (yeah, right, like thats gonna happen...)

bomarmonk’s picture

Thank you for your time and patience with my question. I figured that was the case, but now I at least know that I added the custom region correctly. To the documentation (onward and forward)...

Ankit22’s picture

I guess u must have used the function twice... coz thr is already a function present in the template.php .... you would have copy pasted the given piece of code again ... which will give an error ... blank page

Instead u just needed to add the code inside the function (which is already thr) ... in the template.php

this might be a case ....

kollo-dherbois’s picture

This code given above didn`t work for me too:

function themeName_preprocess_node(&$vars, $hook) {
  $vars['custom_region'] = theme('blocks', 'custom_region');

then try this:

function phptemplate_preprocess_node(&$variables, $hook) {
  $variables['upcomment'] = theme('blocks', 'upcomment');

use "phptemplate" instead of your theme name. I think it depends on your theme which of two variants willl work...

nxqamar’s picture

Jeff Burnz method works. Make sure not to repeat my mistake by adding print $custom_region in page.tpl too.


mincevv’s picture

Just deal with same thing. Problem is in info-file. You shouldn't use "_" for region machine name. To make it work after changing this, please empty your cache.

hollybeary’s picture

Can I just say that I love you? Works perfect, thank you so much!

brei9000’s picture

I get the following error:

Warning: Call-time pass-by-reference has been deprecated in [...]/template.php on line 112
I am trying to find a solution.

MRX’s picture

try in your php.ini set - allow_call_time_pass_reference to on. Or in .htaccess - php_value allow_call_time_pass_reference 1, or may be do not use this "&" with $vars.

madaxe’s picture

Many thanks to Jeff Burnz for his contribution.

I got this working in no time by adding his code to the template.php, node.tpl.php and specifying my regions in the theme info file.

IamOnStage’s picture

This is great, but when i have the

function mytheme_preprocess_node(&$variables) {

  // Get a list of all the regions for this theme
  foreach (system_region_list($GLOBALS['theme']) as $region_key => $region_name) {

    // Get the content for each region and add it to the $region variable
    if ($blocks = block_get_blocks_by_region($region_key)) {
      $variables['region'][$region_key] = $blocks;
    else {
      $variables['region'][$region_key] = array();

code in the template.php this alone produces a 'Fatal error: Allowed memory size of 67108864 bytes exhausted' error. Even without specifying the code in the node.tpl.php file.

Any ideas on how to print a specific region with out loading all the others and thus minimizing the php memory load?

gausarts’s picture

You shouldn't call a very expensive system_region_list(). Instead, add your own defined node regions array, then do the loop for those only regions.

love, light n laughter

mudi..’s picture

I have been spent many hours searching for this information. Finally this is how i got it.

Add custom region or specific block in node.tpl.php or any custom node-content-type.tpl.php.

Step 1:-
First let us define the region in the theme info file.

regions[custom] = Custom Block

Step 2:-
Now add your custom region to the node.tpl.php or node-content-type.tpl.php.

print $custom;

Step 3:-

Create the preprocess_node function in template.php file in your theme folder

* preprocess hook to add variables to the node.tpl.php
function themename_preprocess_node(&$variables) {
$variables['custom'] = theme('blocks', 'custom');

Praveen Karan