How to know where to assign regions data in drupal 7

105 views Asked by At

I have a query regarding regions in drupal 7 . This is the code of page.tpl.php file inside my theme . I have declared these regions in leadsnow.info file inside my theme folder. But couldn't get any idea how to use them . Like if i want to keep a piece of html tags inside a region , yhen how would i do that . Do I need to create any file and place those divs in some file , if so then kindly guide me on this . I am new to drupal , and want to create a drupal theme from a custom raw html file . Please help.

//======page.tpl.php==========
<?php if ($page['header']): ?>    
  <?php print render($page['header']); ?>
<?php endif; ?>

  <?php  print render($page['content']);

  <?php print render($page['footer']); ?>
2

There are 2 answers

0
Soumik On BEST ANSWER

After doing some research and development work , i came to this point . We generally declare regions to be used in out page.tpl.php page . Now after that if we want to show any data , on any region we have to do that through some block , for that we have to create a block from admin pannel and assign some region to it . Then we can create a .tpl file for that block of that region and fetch data and show it . I guess , this is the way it is done in Drupal .

3
Mohit Wadhwa On

In Page.tpl.php you can only wrap your region in custom HTML as required. Like

<div class="header-wrapper">
<?php if ($page['header']): ?>    
  <?php print render($page['header']); ?>
<?php endif; ?>
</div>

If you want to add HTML in your regions then you have to create another template file.

Read about theme hook suggestions here https://www.drupal.org/node/1089656 and you will be more clear regarding working of templates.

Thanks.