Re: mixing HTML and PHP code
| From: | Iv�n S�nchez Ortega \"MR\" | Date: | Sat, 13 Jan 2001 21:48:14 +0000 |
| Subject: | Re: mixing HTML and PHP code | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-34413@lists.php.net to get a copy of this message | ||
"Mark Maggelet" ...
> I think you missed something:
>
> <?
> while (fetch_row_from_query()){
> $output = data_from_fetched_row();
> $more_output = more_data_from_fetched_row();?>
> <TR>
> <TD><?echo $output?></TD>
> <TD><?echo $more_output?></TD>
> </TR>
> <?}?>
> </TABLE>
> tell me that's not easier on your eyes :)
Yes, but i wrote that because the way i learned PHP...
As i learnt from the manual, i thought that a while() loop could have 2
different sintax:
while($something)
{
do_something();
}
while($something): ?>
some html goes here
<? endwhile;
And i tought that the embedded html has to be just embedded html, and that i
had to put ?> <? that way... (i finnaly used the { } way)
But now, i see that PHP is much more flexible than i tought... <? and ?>
just "turn on and off" PHP parsing & executing, something outside <? ?> can
be thought as just echoed... <? ?> quotes have nothing to do with loop
sintax as they are just ignored...
I've really caught the idea of how <? ?> works with loops.