PDA

View Full Version : different colour repeat region..



Patch^
July 17th, 2007, 08:20 AM
Hi guys, quick question...

I know how to make a repeat region with php, but how do you get it so that each repeat region has a different colour so it goes i.e. blue, white, blue, white, blue etc?

There is an example on the link below to show what I mean, it's the comments bit:

http://www.macupdate.com/promo/

Thanks, any advice or input would be great!

icio
July 17th, 2007, 08:31 AM
You could do something like

$row = 0;
// Loop {
echo "<tr class=\"row".($row%2+1)."\"><td>Stuff</td></tr>";
$row++;
}

And then with CSS you could specify the properties of each row

.row1 { background-color: #00F; }
.row2 { background-color: #FFF; }

Hope that helps :thumb:

Patch^
July 17th, 2007, 08:48 AM
ah ok, thanks icio! I'll give it ago later and let you know how I get on :)