How to add regions in drupal

Share

How to add regions in drupal

How to add regions in drupal theme

This is the blog for those who use pre-written Drupal themes on Drupal.org or from some other sources, but want to add a region in the theme, say for example you want to add add region above the content region.

So now we are here to add our own region in drupal theme, where you can have any block in that region.

Well, here we go.

I suppose you are using Drupal’s Garland theme while writing this blog, These steps can be applied on any other theme also.

You need to modify 2 files in your theme

Inside garland.info, add the line with myregion (You can use any name as you want) :

When declaring a new region for the first time via the theme’s .info (i.e garlandd.info) file we must also declare all of the default regions as well as the new region. So, we must add:

So finally your garladn.info will look like below.

Now open page.tpl.php:

And add code below in the HTML where you want your region to be displayed.

In this case I will add it above content area in the HTML.

Please note as that you need to clear Drupal’s cache in order to see the newly created region in the blocks list.

You can leave a comment if you need any more information on this.

Please feel free to login using google or facebook and create a forum topic to get your query answered in few hours here http://www.learn-drupal.in/forums/forum/drupal-forum-post-installation

Thanks

Follow me

Latest posts by Sachin Wable (see all)

Sharing is cool...Share on Facebook
Facebook
Tweet about this on Twitter
Twitter
Share on LinkedIn
Linkedin
affiliate_link

843 views

One comment

  1. chaitra says:

    Thank you Sachin 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *