RE: [PHP] alternating colors
| From: | Jerry Lake | Date: | Fri, 20 Oct 2000 15:49:26 +0000 |
| Subject: | RE: [PHP] alternating colors | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-21411@lists.php.net to get a copy of this message | ||
I can't seem to get that to work inside another function.?
any thoughts?
/*************************************
function show_table($Data)
{
reset($Data);
echo '<style type="text/css"> .border {
border-bottom-width : thin;
border-style : solid;
border-color : black;
border-left-width : 0;
border-right-width : 0;
border-top-width : 0;
}
</style>';
echo '<div align="center">';
echo '<TABLE border="0" cellspacing="0"
cellpadding="2">';
while (list($Name, $Value) = each($Data))
{
echo "<TR><TD
class=border>$Name</TD><td><b>:</b></td><TD
class=border>";
if (is_array($Value))
{
show_table($Value);
} else {
echo $Value;
}
echo '</TD></TR>';
}
echo '</TABLE>';
echo '</div>';
}
show_table($HTTP_POST_VARS);
Jerry Lake - jerryl@europa.com
Web Designer
Europa Communications - http://www.europa.com
Pacifier Online - http://www.pacifier.com
-----Original Message-----
From: Mark Maggelet [mailto:maggelet@mminternet.com]
Sent: Thursday, October 19, 2000 5:00 PM
To: rodney@wincubic.com; php-general@lists.php.net
Subject: Re: [PHP] alternating colors
On Thu, 19 Oct 2000 13:32:37 -1000, Rodney Davis
(rodney@wincubic.com) wrote:
>I am trying to alternate table bgcolor with each iteration of
>the following loop:
>
>print
>"<td><b>One</b></td>\n<td><b>Two</b></td>\n<td><b>Three</b></td>\n</t
>r>";
>foreach ($list as $row)
> {
> print "<tr>\n";
> print "<td> $row[one] </td>\n<td> $row[two] ";
> print " </td>\n<td> $row[three] </td>\n</tr>\n<tr><td
>colspan=3>
>$row[four] </td>\n</tr>\n";
> print "<tr>\n<td colspan=3> $row[five] </td>\n";
> print "</tr>\n";
> }
>print "</table>";
>
>So that every three rows will be a single grouped color different
>from the
>next three rows.
>Does anyone know how to do this ?
something like this should work:
$colors=array("red","white","blue");
$i=0
for(;;){?>
<tr bgcolor="<?echo $colors[$i++%3]?>">
<td>blah blah</td>
</tr>
<?}
- Mark
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net