Re: Alternating Row Colors in PHP........
| From: | Brian V Bonini | Date: | Sun, 09 Feb 2003 00:33:55 +0000 |
| Subject: | Re: Alternating Row Colors in PHP........ | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-134919@lists.php.net to get a copy of this message | ||
On Sat, 2003-02-08 at 18:25, CF High wrote:
> Hey all.
>
> I'm coming from Cold Fusion to PHP; in CF I could alternate rows with the
> following:
>
> <tr bgcolor="###Iif(((CurrentRow MOD 2) is
> 0),de('FFFFFF'),de('EEEEEE'))#">
>
> Any ideas how to do this in PHP?
>
One possibility:
while (whatever) {
$bgcolor = ($i++ & 1) ? '#c0c0c0' : '#ffffff';
echo "<tr bgcolor=\"$bgcolor\"><td>bla-bla</td></tr>";
}
-Brian