Drupal 7: Specify header for a given page
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 开发者_JAVA技巧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.
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.
精彩评论