Using Zen Cart’s cPath System for Style Changes
Tuesday, August 26th, 2008You probably already know that you can style certain category links differently based on the cPath. If not take a look at the notes in the file includes/templates/template_default/sideboxes/tpl_categories.php.
Using that same method, you can style the header, footer, and other parts of your site depending on the current cPath.
For example, let’s say you have a category on your web site that lists children’s decor. You want this area to have a more playful feel with a polka dot background for the header area. The category path is 5.
1. Open includes/templates/template_default/common/tpl_header.php
2. Right before the <div id=”headerWrapper”> type:
<?php
if ((int)$cPath == 5) {
<div id =”headerWrapperChildrens”>
the rest of the code here
</div>
} else {
<div id=”headerWrapper”>
the rest of the code here
</div>
}
3. Save the file and upload it to includes/templates/YOUR_CUSTOM_TEMPLATE/common/
4. Open your stylesheet.css file and define the style for #headerWrapperChildrens
Of course, this approach can be taken with many sections of your web site, the possibilities are up to you!
