Page 1 of 1

Change background pic based on news category/title/alias

Posted: Wed Jan 24, 2007 4:54 pm
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

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

Posted: Wed Jan 24, 2007 5:18 pm
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?