Adding a New Drupal Block Position

tutuploadsmedia_1273256567138.png

We’re going to be adding a block position to a Drupal 6 theme called ShallowGrunge: http://drupal.org/project/shallowgrunge

The Goal

tutuploadsmedia_1273256567138.png

One of our students wanted to put a block position inside the red header bar. If you haven’t done so already, download and install ShallowGrunge: http://drupal.org/project/shallowgrunge

The Current Blocks

tutuploadsmedia_1273256707673.png

Currently there is only a “content” and a “right sidebar” region.

Finding Where to Insert

tutuploadsmedia_1273257642831.png

I’m using the WebDeveloper toolbar for Firefox to help me identify the red header bar’s area. I click on CSS >> View Style Information and then click on the area. The toolbar tells me that the area is called #menu

Opening the Files

tutuploadsmedia_1273256831165.png

In your site files, navigate to sites / all / themes / shallowgrunge / shallowgrunge.info and open that file

Add the Region Name

tutuploadsmedia_1273257117855.png

This file contains all the information Drupal needs to know about the theme. Now we’re going to tell it about our new region. Currently only two regions are defined in this file. You’ll need to add another using this line: regions[header] = Header

Open page.tpl.php

tutuploadsmedia_1273257231150.png

The file that controls the layout of our theme is page.tpl.php so let’s open that up.

Add the Region Code

tutuploadsmedia_1273257391775.png

We scroll down in the file until we find the div called “menu” and we can insert our block code into there. The syntax is: {codecitation}{/codecitation}

Check Your New Region

tutuploadsmedia_1273257562262.png

Check back in Administer >> Site building >> Blocks and your new “header” region should show.

{loadposition drupalnewsletter}

Author

  • Robbie Adair

    Robbie started her career in corporate training until starting her own custom training and media company almost seventeen years ago. In 2010, she began doing classroom training for OSTraining while running Media A-Team. She is often presenting about various tech topics such as Joomla, Fabrik, Web Development, Social Media, and Augmented Reality. She loves seeing that "ah-ha" moment in peoples eyes in her sessions and workshops. She lives in Houston, Texas, but enjoys all the travel for client work and speaking gigs.

    View all posts
0 0 votes
Article Rating
Subscribe
Notify of
guest

3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Colin Mctavish
Colin Mctavish
13 years ago

Hi,

Thanks for the tutorial. Is it possible to make a region a designated size over an image in the header? I would like to place a language switcher in my header of to the side while sharing it with a header image.

Is this possible?

Thanks

Mohammad
Mohammad
13 years ago

Colin, i Think yes but u need some CSS effect .

My
My
13 years ago

Just what i needed… thanks

3
0
Would love your thoughts, please comment.x
()
x