1

I know all about adding a region on page.tpl.php and even node.tpl.php in Drupal 6. But, I have a special case where I need to add a region within another region.

In my Drupal install I found the region.tpl.php file which looks like the following:

<div class="<?php print $classes; ?>">

<?php print $content; ?>

</div><!-- /.region -->

I amended it to output my custom region:

<div class="testing <?php print $classes; ?>">

<?php print $content; ?>

<?php if ($inner_sidebar_right): ?>
    inside inner-sidebar-right
  <div class="inner-sidebar-right"><?php print $inner_sidebar_right; ?></div>
<?php endif; ?>

It doesn't work.

ps: When adding regions in node.tpl.php you have to manipulate _preprocess_node in template.php. Is there perhaps a _preprocess_region function to help accomplish this?

halfer
  • 19,824
  • 17
  • 99
  • 186
sisko
  • 9,604
  • 20
  • 67
  • 139
  • i think the template name should be **block-[region].tpl.php** like _block-header.tpl.php_, and their preprocess function __preprocess_block_ – yoavmatchulsky Jul 06 '11 at 11:35
  • It seems _preprocess_block will works on the block not the region that contains the block ??? – sisko Jul 06 '11 at 12:31
  • Perhaps, you should provide more information on your "special case". Blocks live within regions. Regions don't live within regions and if they do, it's a hack. It sounds like you just need to simplify your layout or consider something like Panels. –  Jul 27 '11 at 19:50

1 Answers1

0

You can use drupal_get_region_content() to load the content for any region. So you could theoretically add the following line of code at the beginning of your template for the desired result:

<?php $inner_sidebar_right = drupal_get_region_content('inner_sidebar_right'); ?>

However, as mentioned in the comments to your original post, I would not recommend this as an ideal solution. Depending on your end goal, there is most likely a more graceful way to accomplish this.

sheena_d
  • 245
  • 1
  • 4