View Single Post
  #1  
Old 01-05-2009, 04:49 PM
 
joannet joannet is offline
 

Senior Member
  
Join Date: Mar 2006
Posts: 105
 

Default Changing Individual Category Background Colours

Hi,

I would like to change the background colours of 3 category headings in the categories.tpl. Each of these individual categories are to be different colours, and the remaining categories are to stay the original colour.

The original code for this template was:

{if $config.General.root_categories eq "Y"}
{foreach from=$categories item=c}
<div><a href="home.php?cat={$c.categoryid}" class="menulink">{$c.category}</a></div>
<div style="height:3px;"><img src="{$ImagesDir}/spacer.gif" width="10" height="3" alt="" /></div>
{*<table width="200" cellpadding="0" cellspacing="0" border="0" height="1"><tr><td><img src="{$ImagesDir}/spacer.gif" border="0" width="1" height="1" alt="" /></td></tr></table>*}
{/foreach}
{/if}

I have changed it to the following with no success:

{if $config.General.root_categories eq "Y"}
{foreach from=$categories item=c}
{if $categories[cat_num].categoryid == "281"}
<div><a href="home.php?cat=281" class="menulink1">Category A</a></div>
<div style="height:3px;"><img src="{$ImagesDir}/spacer.gif" width="10" height="3" alt="" /></div>
{/if}
{if $categories[cat_num].categoryid == "284"}
<div><a href="home.php?cat=284" class="menulink2">Category B</a></div>
<div style="height:3px;"><img src="{$ImagesDir}/spacer.gif" width="10" height="3" alt="" /></div>
{/if}
{if $categories[cat_num].categoryid == "280"}
<div><a href="home.php?cat=280" class="menulink3">Category C</a></div>
<div style="height:3px;"><img src="{$ImagesDir}/spacer.gif" width="10" height="3" alt="" /></div>
{/if}
{if $categories[cat_num].categoryid ne "281" || $categories[cat_num].categoryid ne "284" || $categories[cat_num].categoryid ne "280"}
<div><a href="home.php?cat={$c.categoryid}" class="menulink">{$c.category}</a></div>
<div style="height:3px;"><img src="{$ImagesDir}/spacer.gif" width="10" height="3" alt="" /></div>
{/if}

{*<table width="200" cellpadding="0" cellspacing="0" border="0" height="1"><tr><td><img src="{$ImagesDir}/spacer.gif" border="0" width="1" height="1" alt="" /></td></tr></table>*}
{/foreach}
{/if}


I have added new classes to skin1.css (menulink1, menulink2, menulink2) which change the background colour.

Can anybody please advise what I'm doing wrong?

Thanks
__________________
/joannet/
X-Cart version 4.1.9 and above
Reply With Quote