Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Adding Category ID to body tag

Adding Category ID to body tag

Locked

Views: 921

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
23 Sep 2009, 7:06 PM
#1
cherie avatar

cherie

New Zenner

Join Date:
Sep 2009
Posts:
5
Plugin Contributions:
0

Adding Category ID to body tag

version 1.3.8

I would like to be able to style each main category page differently. On other CMS packages I was able to do that through an id tag on each page.

Is there a way for me to get a specific id such as $category_id or $category_name in the body tag to allow me to be more specific with my css?

thanks

Cherie

23 Sep 2009, 7:30 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Adding Category ID to body tag

Zen Cart allows you to use supplemental stylesheets on a per-page/per-category basis. Look at the CSS_readme.txt file in /includes/templates/template_default/css/ for a full list of options. For category id 23, add a file named c_23.css to your template's /css/ folder.

24 Sep 2009, 2:35 PM
#3
cherie avatar

cherie

New Zenner

Join Date:
Sep 2009
Posts:
5
Plugin Contributions:
0

Re: Adding Category ID to body tag

Thanks. I was just hoping to be able to include the change all on one page. But this works. Messy, but gets it done.

24 Sep 2009, 3:33 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Adding Category ID to body tag

If you want to keep the styling in one stylesheet, you could use Smart Backgrounds. It requires you to save an image with a relevant filename (can be a dummy 1x1px file) for each category you want to identify, but once you do that, you will have a custom classname for the body. Non-identified cats, pages, etc. get the base classname. You can identify by top cats or individual subcats as you like.