I would like my tables (ie the Receipt page and Your Payment History tab) to have alternate row classes. Is this possible with the Smarty {foreach} tags? Here's the code as is: Code: {foreach from=$receipt_products item=p} <tr> <td>{$p.title}</td> <td>{$config.currency|default:"$" {$p.subtotal|string_format:"%.2f"}</td> </tr> {/foreach} And here's an example of the code that I would like have automatically generated (see how one row is odd, while the other is even): Code: <tr class="odd"> <td>{$p.title}</td> <td>{$config.currency|default:"$" {$p.subtotal|string_format:"%.2f"}</td> </tr> <tr class="even"> <td>{$p.title}</td> <td>{$config.currency|default:"$" {$p.subtotal|string_format:"%.2f"}</td> </tr> Any creative suggestions on how I could accomplish this?
Sure PHP: {foreach from=$receipt_products item=p} <tr class="{cycle values="even,odd"}"> <td>{$p.title}</td> <td>{$config.currency|default:"$" {$p.subtotal|string_format:"%.2f"}</td> </tr>{/foreach}
cycle values="even,odd" You can also use it like cycle values="type1,type2,type3" Thats cool code Didnt know about that. Thanks! David