| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Changing Individual Category Background Colours | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() 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 |
|||||||
#2
|
|||||||||
|
|||||||||
![]() you are over complicating it.
do something like this. {if $config.General.root_categories eq "Y"} {foreach from=$categories item=c} <div><a href="home.php?cat={$c.categoryid}" {if $c.categoryid eq "281"}class="menulink1"{elseif $c.categoryid eq "284"} class="menulink2"{elseif $c.categoryid eq "280"}class="menulink3"{else} class="menulink"{/if}>{$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}
__________________
xcart 5.1.2 |
|||||||||
#3
|
|||||||
|
|||||||
![]() Hi Ashley,
Worked perfectly! Thanks heaps for your expertise and efficient response ![]() |
|||||||
#4
|
|||||||||
|
|||||||||
![]() no problem. glad to help.
__________________
xcart 5.1.2 |
|||||||||
#5
|
|||||||
|
|||||||
![]() Look at you bring the new moderator muscle to the table Ashley...I just used this on something and I went about it a much more difficult way and I just changed to your way. thanks
__________________
X-Cart Pro 4.1.9 PHP5.2.5 MySQL 5.0.54 IIS/Apache/NGINX Webservers |
|||||||
![]() |
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|