Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Custom body id and class

Custom body id and class

Views: 645

Results 1 to 2 of 2
27 Sep 2011, 2:14 PM
#1
plinth avatar

plinth

New Zenner

Join Date:
Sep 2011
Posts:
14
Plugin Contributions:
0

Custom body id and class

Hey all, found this old thread covering the subject of defining a different body id/class on different pages.

This is a very useful feature, and the thread seemed to provide no solid, simple solution. At present my body tag looks like this:

<body id="<?php echo $body_id . ''; ?>" class="">

Although this changes on static pages (like <body id="aboutus" class=""> for example), once I'm inside the shop all the body id's are the same (<body id="shopindex" class="">).

Ideally I'd like the body id to be something like "shop" and the class to be the category, like this:

<body id="shop" class="hampers">

It wouldn't have to be the name of the category, the ID number would do. Any suggestions? Thanks in advance!

27 Sep 2011, 5:23 PM
#2
gjh42 avatar

gjh42

Black Belt

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

Re: Custom body id and class

The latest version of Smart Backgrounds can assign a body class tag reflecting the current top category or subcategory id (not name). This should be applicable to styling any page element you want.