Using foreach, how do you alternate product list Div's background color
On the product list page... I would like products to appear with alternating background colors.. searched the forums but not finding a quick solution... the code is for products_list.tpl here is the snippet of code I'd like to edit:
<div class="products products-list">
{foreach from=$products item=product}
{assign var="url" value="product.php?productid=`$product.productid`& amp;cat=`$cat`&page=`$navigation_page`"}
{if $featured eq 'Y'}
{assign var="url" value=$url|cat:"&featured=Y"}
{/if}
<div class="item" style="background:#F9F0E9;text-align:center;vertical-align:middle;">
I'm thinking it should be as simple as creating an IF statement and adding some sort of array to determine odd even variable... sliding the IF variable=array show DIVx ELSE show DIVy... any ideas?
|