Change row background color after each new entry

2 posts by 2 authors in: Forums > CMS Builder
Last Post: March 19, 2010   (RSS)

The site I'm building is almost ready to go online and your support has been great, thanks for that! I've got one (last?) question, which is more layout related than anything else.

I want to display a record in a table row with a white background and the next record in a table row with a grey background. Then back to white, grey, white etc....

This is the code I've got:

<tr><?php foreach ($articlesRecords as $record): ?>
<td bgcolor="#FFFFFF"><span class="style49">
<br />
<?php echo $record['content'] ?><br/>

<?php if (!$articlesRecords): ?>
No records were found!<br/><br/>
<?php endif ?>
</span></td>
<?PHP $maxCols=1; if (@++$count % $maxCols == 0): ?></tr><tr><?PHP endif; ?> <?PHP endforeach; ?> </tr>

It works beautiful, putting each record in a new row, but how do I change the bgcolor of every row?

Thanks in advance!