table row style alternation, need 2 records per foreach()...I think...

5 posts by 2 authors in: Forums > CMS Builder
Last Post: February 2, 2009   (RSS)

By markr - January 29, 2009

Need help with list viewer code mod.

Using data in table rows with alternating styles (e.g. background color alternates between white and gray for better visability). Need a foreach() that will give me two records then loop. Any ideas?

Re: [markr] table row style alternation, need 2 records per foreach()...I think...

By Dave - January 30, 2009

Hi markr,

Here's some code to do that:
<?php $bgColor = (@$bgColor == '#FFFFFF') ? '#666666' : '#FFFFFF'; ?>

Then you can display it like this: <?php echo $bgColor ?>

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] table row style alternation, need 2 records per foreach()...I think...

By markr - January 30, 2009

Worked great...thanks!

Re: [markr] table row style alternation, need 2 records per foreach()...I think...

By Dave - February 2, 2009

Thanks! :)
Dave Edis - Senior Developer
interactivetools.com