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).

 



I noticed that you have

I noticed that you have mentioned Drupal Themes live at you page www.sitebuddy.com/taxonomy/term/69.

A few months ago (with release of Drupal 5.0) this site was closed, but I found that some guys lounched very similar site with same purpose.
At themegarden.org you can see in action (live) drupal themes for both Drupal 4.7 and Drupal 5.

Thanks for the info. I've

Thanks for the info. I've update that link.

Thanks

Just what I was looking for.