开发者

Working with Blocks in Drupal 7

开发者 https://www.devze.com 2023-02-21 13:57 出处:网络
How do 开发者_StackOverflow中文版you create a Region in Drupal 7 Also how do you print out the contents of that region in page.tpl.php?

How do 开发者_StackOverflow中文版you create a Region in Drupal 7 Also how do you print out the contents of that region in page.tpl.php?

Thanks for any help.


Open you theme's .info file, where regions have been defined. There if you want to add region you can add and have to write the following code in page.tpl to call

<?php if ($page['new_region']): ?>
  <div id="new_region" class="col new"><div class="section">
    <?php print render($page[new_region']); ?>
  </div></div> 
<?php endif; ?>


This should help you: http://drupal.org/node/1088718#comment-4194802


First you have to define region in your Theme's info file like this

regions[new] = New Region

Then add following code in your page.tpl.php

<?php if ($new): ?>
 <div id="new">
        <?php print $new; ?>
 </div>
<?php endif; ?>
0

精彩评论

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