that table-row-color-switching thing - again!
| From: | Derek Sivers | Date: | Sat, 02 Dec 2000 07:30:27 +0000 |
| Subject: | that table-row-color-switching thing - again! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-28347@lists.php.net to get a copy of this message | ||
just to beat a dead horse...
here's the most efficient way I've found to change HTML table row colors as you loop through an array of info:
$row = 1-$row;
$color = ($row==0)?"#eeeeee":"#ffffff";
that's it. just those two lines. (use $color for <td bgcolor=$color>)
you don't need to define $row or $color beforehand.