Robo_1 Posted September 15, 2011 Share Posted September 15, 2011 I've spent the past few hours banging my head against this problem, and I'm wondering if anyone can help. Basically, what I'm looking to do is give the body element a class of the same name as the category it's associated with. So if I have a shop which sells widgets, what I'm looking to do is give the category and product pages associated with blue widgets, a blue-widget class on the body, so that I can add custom styles to match that category on some of the template elements. I've tried doing this: <body class="{$category.cat_name}"> but what's suitable as a title isn't always suitable for a class, and as soon as I had titles of more than one word, everything quickly fell apart. I've also considered subverting the meta-keywords option to get the word I need, but obviously that would be a rather messy fix. So if anyone can think of how I could do this, I'd be most appreciative. Thanks. :) Quote Link to comment Share on other sites More sharing options...
kyle Posted November 11, 2011 Share Posted November 11, 2011 Did you ever get anywhere with this? I'm trying to figure out the same thing right now. As far as I know the code you posted won't do anything because you need to pair the call for the Category Name to a database call that's usually in an inc.php file. Not that it's helped me solve the problem yet either. Did you find anything else out? Sorry I can't be of more help to you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.