Adding new regions to drupal theme

Assume we have some block that we want to put at the bottom of the page. If we define two blocks to be at the same region they will appear one below the other. Now it can happen that we would like to have two blocks on the same line.
To achieve that we have to define a new region.
Go to your theme folder and edit the .info file.
Add these lines:
regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer

The define the standard regions of almost every theme. Please do not skip this stage.

Now let us add a custom region and call it "Footer left"
regions[footer_left] = Footer left

Next step is to define where exactly this region will appear. Edit the page.tpl.php
Choose the position of the new region and put this code inside the html element:
E.g
<div id="footer">
<div id='footer_left' style='float: left;'><?php print $footer_left; ?></div>
<?php print $footer_message ?>
<?php print $footer ?>
</div>

If you go to admin->block probably you won't see the new region, so you would have to go to the theme administration, edit the properties of the selected theme and save it.

Post a Comment

Previous Post Next Post