How do I create a different header for different sections?

pkcho's picture

How do I create a different header for different sections?

For example, if I have the main News section and then Chamber of Commerce and then Multimedia, and I want each of those sections have a different header that adds distinction to that section.

Is this done by creating different page-front.tpl.php, page-news.tpl.php, page-chamber.tpl.php, etc...? Also, how do I make sure the subordinate pages keep the same header?

Thank you,
Joe

Comments

I use the context layout

Adam S's picture

I use the context layout module that comes with the context module. What this does is set parameters in the openpublish.info theme file that establishes different page.tpl.php and css files based on context. The rubik theme has a subtheme called cube. If you look at the code in in cube.info you can see how the context layouts are defined.

Once the context layouts are defined -- in cube there is split 50/50 and side columns 66/33 -- you will have the choice of which layout and the regions defined by that layout definition. The layout can be triggered by context such as user role, view, or path. Each page in this context with share the layout as defined. This way you can have three different page.tpl.php files all importing a different header if you like.

Another way to accomplish this, if you just want to change the images or color of the header, is to use the context theme reaction. This lets you set a class in the body tag based on context. With the different classes you can control the header CSS, background images, and color, for example.

Marine job board with Drupal 7 at http://windwardjobs.com

Adam, Thank you for your

pkcho's picture

Adam,

Thank you for your help. I didn't consider Context, but I'm glad that it's possible through it.

I want to do some more reading up so I understand what you're saying, by chance would you happen to know of any good documentation or tutorials that might help with this?

Thank you!

Include 2 headers

hilalmohammed1993's picture

Create two header twig templates in your theme files and include them in your page.html.twig file which renders the page in general.
use: {% include directory ~ '/includes/header.html.twig' %}
or use: {% include '@architect/includes/header.html.twig' %} , where architect is the theme name.

Newspapers on Drupal

Group organizers

Group categories

Topics - Newspaper on Drupal

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: