How to add a region to drupal themes

 

Requirements
Download the Zen Theming project
http://drupal.org/project/zen
Download the CTI Flex Theme
http://drupal.org/project/cti_flex


Usefull
Zenophile, tool for creating Subthemes of the Zen project, eliminating manual copying and editing.
http://drupal.org/project/zenophile
Drupal version 6.x
http://drupal.org/

 
Locating the theme
If you want to add a region to the default cti flex / Zen theme go the directory in which you have the cti flex default theme installed.

In my case \sites\all\themes\cti_flex
 
Editing the files
If you want to add a region you need to edit two files
- page.tpl.php
- cti_flex.info

example:
I want to add a region above the header logo called header top.
 
edit: page.tpl.php

<div id="header"><div id="header-inner" class="clear-block">

    <?php if ($header_top): ?>
        <div id="header-top">
        <?php print $header_top; ?>
        </div> <!-- /end #header-top -->
    <?php endif; ?>


      <?php if ($secondary_links): ?>
        <div id="secondary">
          <?php print theme('links', $secondary_links); ?>
        </div> <!-- /#secondary -->
      <?php endif; ?>
..etc

edit: cti_flex.info
regions[header]             = header
regions[header_top]     = header top
regions[footer]               = footer
 
Adding block
If you now go to Administer|Site building|Blocks a new region will appear with the name header top.
 
Theming the block
 If you want to add some css edit the file cti-fles.css

/** ------------------------------- HEADER -------------------------------- **/

#header-top { height: 20px;}