Jordash
Jordash

Reputation: 3103

Working with Blocks in Drupal 7

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

Upvotes: 0

Views: 153

Answers (3)

Nitesh Agarwal
Nitesh Agarwal

Reputation: 211

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

Upvotes: 0

Vidit Anjaria
Vidit Anjaria

Reputation: 147

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

Upvotes: 1

Laxman13
Laxman13

Reputation: 5211

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

Upvotes: 0

Related Questions