Smarty table is even odd
3 answers
For such a situation smarty has a method called {loop}
<table>
{foreach $products as $product}
<tr class="{cycle values="odd,even"}">
<td>{$product.name}</td>
</tr>
{/foreach}
</table>
The result for this would be:
<table>
<tr class="odd">
<td>1st product</td>
</tr>
<tr class="even">
<td>2nd product</td>
</tr>
<tr class="odd">
<td>3rd product</td>
</tr>
</table>
In your stylesheet, set properties for odd and even lines:
tr.even td{background: #CCCCCC;}
tr.odd td{background: #EFEFEF;}
+12
source to share