| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Using foreach, how do you alternate product list Div's background color | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
![]() 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? |
|||||||||
#2
|
|||||||
|
|||||||
![]() Use cycle instead...
Code:
Code:
__________________
xcartmods.co.uk |
|||||||
|
#3
|
|||||||||
|
|||||||||
![]() Thanks, PhilJ... That's so much simpler than IF and ELSE statements... for future reference can you tell me how the cycle code works... or provide a link to resource... is that built into PHP, SMARTY, etc.?
|
|||||||||
#4
|
|||||||
|
|||||||
![]()
__________________
xcartmods.co.uk |
|||||||
#5
|
|||||||||
|
|||||||||
![]() awesome... thanks
|
|||||||||
|
|||
X-Cart forums © 2001-2020
|