0

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']); ?>
Soumik
  • 137
  • 1
  • 13

2 Answers2

1

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.

Mohit Wadhwa
  • 321
  • 1
  • 2
  • 12
  • OK , if that so , then the code print render($page['header']) , is printing some html data , so this data is stored where , kindly guide @Mohit Madhwa – Soumik Dec 09 '15 at 10:38
  • Yes, it is printing HTML data, this data is stored / written in template files responsible for that. Location of template file is dependent on theme used, like for sub theme = sites/all/themes/sub_theme/templates/responsible_file.tpl.php – Mohit Wadhwa Dec 09 '15 at 10:50
  • I am not creating sub theme , it is just a theme and my theme folder contains following files/folder =>css(folder),js(folder),fonts(folder),images(folder),leadsnow.info,page.tpl.php . I don't have any other files or folders. Now please help me , for regions used in page.tpl.php , where those .tpl file shouldbe created and by what name . Lets say for header region , what should i do @Mohit Wadhwa – Soumik Dec 09 '15 at 11:08
1

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 .

Soumik
  • 137
  • 1
  • 13