tags:

views:

13

answers:

2

Here is my template code:

<li class="{$product.name}" {if $product.name == $filter_product.name}class=active{/if}">

I want to be able to set the $product.name as the class, and when the $product.name is the active filter also add the class "active"

A: 

You can only have one class attribute, but it can contain more than one class - separate them using a space. So in your example:

<li class="{$product.name}{if $product.name == $filter_product.name} active{/if}">
Tim Fountain
Smarty only outputs the first $product.name class.
danit
A: 

Found the answer myself:

{if $product.name == $filter_product.name}
  <li class="active {$product.name}">
{else}
  <li class="{$product.name}">
{/if}
danit