On my theme i have a few pages that get a special banner. This is a static banner so I programatically added it to my theme like this:

<?php if (isset($node) && $node->nid == '5'):?> 
        		<div class="row">
        			<img src="/<?php print drupal_get_path('theme', 'skeletontheme'); ?>/images/banners/banner.gif" />
        				</div>
        				<?php endif; ?> 

Now I have pages like this :http://dmta.right-brain.net/commercial which are taxonomy pages that I styled using views...and I need to add a special banner to these pages too.....But how? I thought I could leverage the body class "page-taxonomy-term " in the manner of which I selected node IDs above.....but I can't figure it out. Templating the view doesn't help, as it won't let me modify the header of the page and dealing with the taxonomy term tpl doesn't work either. Thoughts?
Every time I try to google it, it get things that relate to adding body classes but I really want to just select the page based on the body class and add some custom php/ css to pages that have taxonomy in common.

Thanks,
Rebecca

Comments

nevets’s picture

I would recommend making the banners as blocks and then using the context module to conditionally display them.

I have not used it but Dynamic Banner sounds like another approach.

It general, putting logic like that in the template file should be avoided, if not using a module, using the appropriate preprocess hook (hook_preprocess_page) to implement the logic to set a variable that is output in the template.

beckyjohnson’s picture

Oh ! That's a good idea. thank you for pointing that out. I hadn't thought of that.
Rebecca

beckyjohnson’s picture

Dude thank you so much. You've totally saved my life. I think I may do this with my other conditional nodes too and take that out of the hard coded theme.