Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Changing Individual Category Background Colours

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #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
  #2  
Old 01-05-2009, 05:16 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Changing Individual Category Background Colours

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
Reply With Quote
  #3  
Old 01-05-2009, 06:32 PM
 
joannet joannet is offline
 

Senior Member
  
Join Date: Mar 2006
Posts: 105
 

Default Re: Changing Individual Category Background Colours

Hi Ashley,

Worked perfectly!

Thanks heaps for your expertise and efficient response
__________________
/joannet/
X-Cart version 4.1.9 and above
Reply With Quote
  #4  
Old 01-05-2009, 08:42 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Changing Individual Category Background Colours

no problem. glad to help.
__________________
xcart 5.1.2
Reply With Quote
  #5  
Old 01-07-2009, 12:35 AM
 
Thedae2k Thedae2k is offline
 

eXpert
  
Join Date: Jan 2004
Posts: 288
 

Default Re: Changing Individual Category Background Colours

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
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:36 AM.

   

 
X-Cart forums © 2001-2020