开发者

Drupal region with in a region

开发者 https://www.devze.com 2023-03-17 19:58 出处:网络
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.

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号