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

and

<?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?

Comments

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

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;

Thanks & Regards,
AnAnD | Drupal | Photographer @ MCS | Facebook | Twitter

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

Thanks

Juned Kazi

is this is right?

Thanks & Regards,
AnAnD | Drupal | Photographer @ MCS | Facebook | Twitter

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.

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)) {
   $function(&$vars);
  }
}

This code in node-product.tpl.php

<?php print $related_reports; ?>

Thanks & Regards,
AnAnD | Drupal | Photographer @ MCS | Facebook | Twitter

Done!

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

Thanks & Regards,
AnAnD | Drupal | Photographer @ MCS | Facebook | Twitter

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

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.

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:

<?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:

<?php
print $below_content
?>

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

But this doesn't work...

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

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.

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]

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!

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...)

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)...

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 ....

You are never a looser until you quit trying.

FL4PJ4CK
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...

Money is bad thing :-)

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

Thanks

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.

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

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.

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.

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.

There is no problem in the world that can't be solved with cake and ice cream

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?

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

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.

<?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');
}

Thanks,
karan