The image verification code you entered is incorrect.

Custom regions in Drupal

Here is an executive summary of this feature using phptemplate.

1) In the file \themes\engines\phptemplate\phptemplate.engine
Find the function function phptemplate_regions().

It looks like this:
function phptemplate_regions() {
return array(
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'content' => t('content'),
'header' => t('header'),
'footer' => t('footer')
);

}

Simply add a new region (example: Visible name: Header Ads, internal name header_ads) like so:
function phptemplate_regions() {
return array(
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'content' => t('content'),
'header' => t('header'),
'footer' => t('footer'),
'header_ads' => t('Header Ads')
);

}

2) Add the code (in any of the *.tpl.php template):
<?php print $header_ads;?>
wherever you want to display your new region.

3) Now in the "Administer-->blocks" you will see the new region "Header Ads" you can add any block to that new region.

Voila!

Note: By looking how other regions are handled you can add styling (style.css support) and conditional statement, example:
 <?php if ($sidebar_left) { ?><td id="sidebar-left">
<?php print $sidebar_left ?>
</td><?php } ?>

Just replace sidebar_left with your new region name (example: header_ads).

 



Reply

The content of this field is kept private and will not be shown publicly.
  • 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 Image: you will need to recognize the text in it.
Please type in the letters/numbers that are shown in the image above.