Re: [PHP4BETA] A (Hopefully) simple question *gulp*
| From: | Andreas Pour | Date: | Fri, 28 Apr 2000 03:25:38 +0000 |
| Subject: | Re: [PHP4BETA] A (Hopefully) simple question *gulp* | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14131@lists.php.net to get a copy of this message | ||
John Steele wrote:
> Here's another simple way to let the colors do the work. It can be made into a pretty
> sick one-liner :)
OK, I'll joint the pissing contest ;-).
<?
$color0 = "#ffffff";
$color1 = "#E1DAC1";
// stuff
for ($i=0;$i < $num; $i++) {
echo "<tr bgcolor=\"" . ${color.($i & 1)} .
"\"><td>yada</td><td>spew</td></tr>
// more stuff
}
?>
// more stuff
> <?
> $color1 = "#ffffff";
> $color2 = "#E1DAC1";
> ?>
> <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1>
> <TR>
> <TH>Blah</TH><TH>Blah2</TH>
> </TR>
> <?
> $color = "";
> for ($i=0;$i < $num; $i++) {
> $color = ($color == $color1) ? $color2 : $color1;
> echo "<tr
> bgcolor=\"$color\"><td>yada</td><td>spew</td></tr>
> // more stuff
> }
> ?>
> </table>
>
> Cheers,
> John
> --
> /* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
> * We also walk dogs... jsteele@writeme.com
> * http://www.gamecomputer.com/ssc/
> */
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net