Skip to content

Create a Custom Region in Drupal6

01/09/2011

hi,

i created a custom region in drupal6. i used the Zen based Airyblue Theme.

Default available region in this theme included in themename.info file. If is not available in this file, you first include the available region.


regions[sidebar_first]  = first sidebar
regions[sidebar_second] = second sidebar
regions[navbar]         = navigation bar
regions[content_top]    = content top
regions[content_bottom] = content bottom
regions[footer]         = footer
regions[closure_region] = closure

i add the new custom region in themename.info file name as “header-right” like below


regions[sidebar_first]  = first sidebar
regions[sidebar_second] = second sidebar
regions[navbar]         = navigation bar
regions[content_top]    = content top
regions[content_bottom] = content bottom
regions[footer]         = footer
regions[closure_region] = closure
regions[header_right] = header-right

now the new region display in block. Then where you want the new custom region to appear in your page, included in page.tpl.php. i include the block below the header.


<?php if ($header_right): ?>
<div id="header-right"><div id="header-right-inner">
<?php print $header_right; ?>
</div></div> <!-- /#header-right-inner, /#header-right -->
<?php endif; ?>

Write the css for this

#header-right
{
float: right; /* LTR */
width: 120px;
margin-top: -87px;
margin-left: 0; /* LTR */
padding: 0; /* DO NOT CHANGE. Add padding or margin to #header-right-inner. */

}

#header-right-inner
{
margin: 0 18px 0 0; /* LTR */
padding: 0;

}

Now the new region displayed in the top right corner like,

now assign the block for this region. It will show like

thanks,

Advertisements

From → Drupal

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: