Change background pic based on news category/title/alias

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
Andor
Forum Members
Forum Members
Posts: 49
Joined: Sun Feb 19, 2006 1:42 pm

Change background pic based on news category/title/alias

Post by Andor »

I believe I saw a topic about this earlier and thought that was a good idea for later, but now I can't find it when searching...

I would like to have a specific background picture for each news category that I'm listing. My idea is to select the pic automatically based on the news category (or the title/alias for standard content) and have it all matched in the CSS.

Right now I just add the news module tag and the category "title" as text above the tag - for the moment I suppose I could just select the right CSS class manually in the template for each category "title", e.g.

Code: Select all

<div class="Gen_News">News</div>
{news number='3' category="General news"}
<div class="Ideas">Ideas</div>
{news number='3' category="Ideas"}
but I'm thinking of using a header and have Smarty(?) add the class to the header tag based on what's inside the header tag:

Code: Select all

<h4>News</h4>
{news number='3' category="General news"}
<h4>Ideas</h4>
{news number='3' category="Ideas"}
Any ideas or maybe other directions?

Thanks
3dcandy

Re: Change background pic based on news category/title/alias

Post by 3dcandy »

there's a tag that achieves something similiar in the forge.....
difference is it displays a picture depending on page title, maybe you could go down that route?
Post Reply

Return to “Layout and Design (CSS & HTML)”