Drupal 7: Specify header for a given page

3.2k views Asked by At

I have a header section that's specified in html.tpl.php, but the header should be different depending on what page the user is on. Most of the pages are just a page content type, though I might add other types later, and also the homepage.

What's the best way to specify which header to use and then catch that in home.tpl.php?

I tried creating a custom field for the page content type, but I couldn't figure out how to access it from home.tpl.php, and I'm not sure how you would specify it for other types of pages.

1

There are 1 answers

1
bkildow On BEST ANSWER

If your header consists of things between the <body> tag, perhaps you could create your header in page.tpl.php instead of html.tpl.php. This way you would have access to $node variable and be able to set up your conditional header based on a field or taxonomy term. For something a little more complex, you might want to check out the context module: http://drupal.org/project/context.