Jump to content

[Solved] Different Class Or Id For Each Category


besssbesss

Recommended Posts

Hi,

 

I would like to get different style for each category i have on my website.

I want to put a different background-color for the different categories i have.

Here's my code:

 

<li id="{if $id_category=32}category_32{elseif $id_category=33}category_33{elseif $id_category=34}category_34{/if}" {if isset($last) && $last == 'true'}class="last"{/if}>
<a href="{$node.link|escape:'htmlall':'UTF-8'}" {if isset($currentCategoryId) && $node.id == $currentCategoryId}class="selected"{/if} title="{$node.desc|escape:'htmlall':'UTF-8'}">{$node.name|escape:'htmlall':'UTF-8'}</a>
{if $node.children|@count > 0}
	<ul>
	{foreach from=$node.children item=child name=categoryTreeBranch}
		{if $smarty.foreach.categoryTreeBranch.last}
			{include file="$branche_tpl_path" node=$child last='true'}
		{else}
			{include file="$branche_tpl_path" node=$child last='false'}
		{/if}
	{/foreach}
	</ul>
{/if}
</li>

 

With this code, I still have the category_32 generated for my three categories.

Someone has an idea to help me please ?

I'm triyng to solve that since few days now, i can't find a solution. Please help me.

 

Thank you !

Edited by besssbesss (see edit history)
Link to comment
Share on other sites

Hi Pascal,

 

Yes i've duplicate the blockcategories folder. And in each php file of the folder, i put the id of the category i want. And then, in the tpl file, i've put the class i want for each category. And i create the different class in my css.

I was looking for a solution for 3 days now, and it work very well with this one.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...