How To Define New Block Regions in Drupal

0
Your rating: None

In Drupal regions are just areas in themes where blocks need be placed. You can assign blocks to regions and organize them within the Drupal administrative interface at Administer ➤ Site building ➤ Blocks.

The default regions used in themes are left sidebar, right sidebar, header, and footer,
although you can create as many regions as you want. Once declared, they’re made available to your page template files (for example, page.tpl.php) as a variable.

For instance, use <?php print $header ?> for the placement of the header region. You create additional regions by creating a function named name-of-your-theme_regions() within your template.php file.

/*
 * Declare the available regions implemented by this engine.
 *
 * @return
 *     An array of regions. Each array element takes the format:
 *     variable_name => t('human readable name')
 */
function mytheme_regions() {
   return array(
        'left' => t('left sidebar'),
        'right' => t('right sidebar'),
        'content_top' => t('content top'),
        'content_bottom' => t('content bottom'),
        'header' => t('header'),
        'footer' => t('footer')
   );
}

To print out the content top region in your page template, use <?php print $content_top ?>.

 #

First time here and seems that i am at right place now. I have many question regarding drupal. I would like to visit here very often.

 
 #

In Drupal regions are just areas in themes where blocks need be placed. You can assign blocks to regions and organize them within the Drupal administrative interface at Administer ➤ Site building ➤ Blocks.

 

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.

Cumulus Tag Cloud

Kiran Says

SEO Architect,SEO Specialist reflect my values.

By enduring black hat methods the SEO industry is setting itself up for washout and sleepwalking into oblivion.

Jobs in India