note 41494 added to ref.strings
| From: | baparrish at hotmail dot com | Date: | Mon, 12 Apr 2004 17:12:45 +0000 |
| Subject: | note 41494 added to ref.strings | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-68028@lists.php.net to get a copy of this message | ||
Here's the simplest way I've found to alternate row colors in a dynamically generated HTML
table. If the row number is even then ($row_number % 2) will always return zero.
<?php
function row_color($row_number)
{
if((($row_number % 2) == 0)) { // row is an even number
$color = '#000000';
} else { // row is an odd number
$color = '#ffffff';
}
return $color;
}
?>
----
Manual Page -- http://www.php.net/manual/en/ref.strings.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+41494
Delete -- http://master.php.net/manage/user-notes.php?action=delete+41494&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+41494&report=yes
Search -- http://master.php.net/manage/user-notes.php