Skip to main content

Drupal : How to define custom regions

If you want to have your own set of regions for a theme, you do this by defining a _regions() hook. In this case, your custom regions will override those defined by default in PHPTemplate.

If the theme doesn't have a template.php file in its directory, create one; otherwise use the existing template.php file. In either case, add a mytheme_regions() function to define your regions. Each region needs to have a name (a string with no spaces) and a description (the text that will show up in, for example, the block configuration pages). The following would define all the standard PHPTemplate regions except the left sidebar and, in addition, two new regions for a theme called "mytheme".

t('right sidebar'),
'content' => t('content'),
'header' => t('header'),
'footer' => t('footer'),
'floater' => t('floater'),
'inline1' => t('inline 1')
);
}
?>

Note: Regarding the name of the function:

* use the name of your theme instead of mytheme_regions(), eg: bluemarine_regions()
* Don't use a hyphen in the name of a region; an underscore is OK.
* Also, your theme name is your base theme name not the name of your style.css directory (if you are using one). For example, box_cleanslate overrides the style.css file of the box_grey theme; therefore you should name your function box_grey_regions.

Comments

Popular posts from this blog

Real time Sinhala Unicode converter

Following Sinhala unicode translater is a very useful tool for all the Sinhala web users who needs a quick sinhala unicode typing. The main advantage of this tool is that user can type the sinhala characters using English (commonly known as Singlish) Use the following link to access the online unicode converter. http://www.ucsc.cmb.ac.lk/ltrl/services/feconverter/t1.html

Convert MPEG to AVI using mencoder in Ubuntu

1. Install mencoder using : $ sudo apt-get install mencoder 2. Move to the folder which contains the .mpeg /.mpg file 3. run the following command :         mencoder INPUTFILE.mpeg -ofps 25 -ovc xvid -oac mp3lame -lameopts abr:br=192 -srate 48000 -xvidencopts fixed_quant=4 -o OUTPUT.avi ** in the example I'm converting INPUTFILE.mpeg to OUTPUT.avi