Wednesday, December 13, 2017 02:15 am EST

Adding new Regions to a Drupal theme

Bri's picture

Have you ever wanted to add a new region to the theme your using? Well in Drupal 6 you can, and it's not very difficult. A region is a section of your template where information, such as blocks, can be placed. By default there are 5 pre-defined regions. They are as follows:

  • header: This region describes the header area of the template.
  • content: This describes the main area of the page.
  • left: This describes one sidebar, typically for block placement.
  • right: This describes the second sidebar, typically for block placement.
  • footer: The footer section contains information that should usually appear after the rest of the content.

Your themes .info file contains the directive letting Drupal know which regions are to be available. If your theme doesn't contain any statements such as :

    regions[header] = header
    regions[content] = content

This is because these are the defaults. They will be available regions even if they are not present. If you wish to define your own regions, however, you need to include them here. If we wanted to add a region called "Content Top", we would open the .info file and add the line:

    regions[content_top] = Content Top

The "content_top" is the internal name of the region, and will correspond to the variable that gets used in the template files. The "Content Top" is the name you have given to this region and will show up on the blocks page when displaying the various regions.

You now need to locate your page.tpl.php template and add the region to it. To add the region, you only need to find the area that you would like to add it to. In our example, putting it right above the content area would make sense. Locate the section in your page.tpl.php file marked as:


<?php print $content; ?>

Before this line of code, add the following:


<?php if ($content_top): ?> <div id="content-top">
<?php print $content_top; ?>
</div> <!-- content-top -->
<?php endif; ?>


Anonymous's picture


Great sharing

Anonymous's picture

Good one

Thanks for the wonderful suggestions and the coding techniques as well to create the Drupal template. That would be a useful technique to enhance the website appearance the people must visit this essay writer review website for the development of their website.

Anonymous's picture

The education essay writing

The education essay writing task is bit difficult to complete from the students side. Even the evaluation is very different in the academics. The essay writing evaluation on academy must be well organized, and student’s thoughts must circulation rationally from one point to the next. So students should be mentioned properly according to their self-discipline in writing. So these things should be followed by the service writers. Present language and opinions on the subject in an impartial and extensive way. Writing a self essay requires the huge amount of knowledge and skill sets. The top and best essay will always keep good format and high-quality essay for the students. Therefore you can get a tension free essay from this best online writing service. Their professional writers are good enough to complete any type of educational essay for students. So struggling students can make use of this service for completing their academic essay writing tasks. This website is giving quality essay in a low cost.