How to create custom regions in drupal?
Drupal is one of famous content management systems. Corporate, News and Shopping Cart sites can easily be built in drupal and sometimes to fulfill our requirements we need to create custom regions in our theme that can be done very easily. You just need to edit your theme’s info file.
- Open your theme directory in which you want to create new region.
- There will be a your_theme_name.info file. Open it in notepad or in your favorite editor.
- In this file you will find your theme complete information i.e. version, style sheets, regions (already created) and here you will define your own region by following statement.
- region[your_region_name] = Your Custom Region
- Your custom region will be shown in Drupal Blocks Admin and you can assign any block or views to that region.
- Following syntax is to access your region in drupal template files.
<?php if( $your_region_name ){ print($your_region_name); } ?>
*your_region_name (give your own region name. This will be a variable by which you will access your region in any page.)
Use self explanatory keywords for your regions for instance gallery, headlines,…