How To Define New Regions in Drupal

Answer

 

To add regions for Drupal 5.x
ADD this code in its entirety to the bottom of your template.php file:
/** Define the regions **/
function framework_regions() {
return array(
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'content' => t('content'),
'header' => t('header'),
'footer' => t('footer'),
'newregion' => t('new region'),
);
}
Replace "newregion" with what you would like to call that region instead. Note that the name on the left before the = is the machine readable format, and cannot have spaces. the name after the = is the human readable format, and can have spaces, capital letters etc. You may add as many regions as you like in the same manner that "newregion" has been added in the example above.
Then, in your page.tpl.php file, define where you would like you regions to be using a print call like so:
You need to replace "newregion" with what you named your region. The id, class and any other html can be changed to anything.


To add regions for Drupal 6.x
ADD the following code to you themename.info file:
regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer
regions[newregion] = New Region

The internal "machine" readable name in square brackets and the human readable name as the value, e.g., regions[theRegion] = The region label.
The contents of the .info file is cached in the database so altering it will not be noticed by Drupal. To clear it, do ONE of the following:
1. Clear button located at "Administer > Site configuration > Performance".
2. With devel block enabled (comes with devel module), click the "Empty cache" link.
3. Simply visit the theme select page at "Administer > Site building > Themes".
Then, in your page.tpl.php file, define where you would like you regions to be using a print call like so:
You need to replace "newregion" with what you named your region. The id, class and any other html can be changed to anything.

All drupal Questions

Ask your interview questions on drupal

Write Your comment or Questions if you want the answers on drupal from drupal Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---