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; ?>
精彩评论