RE: [PHP] mixing HTML and PHP code
| From: | Mark Maggelet | Date: | Fri, 12 Jan 2001 21:26:15 +0000 |
| Subject: | RE: [PHP] mixing HTML and PHP code | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-34298@lists.php.net to get a copy of this message | ||
I think you missed something:
<?
connect_to_database();
parse_query();
execute_query();
?>
<TABLE>
<?
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 :) Another nice thing about
doing it this way is you can work with a web designer who uses a
visual tool like dreamweaver.
On Fri, 12 Jan 2001 22:10:08 +0100, MR (ivansanchez@wanadoo.es)
wrote:
>Alex Black ...
>> <input type="text" name="hello" size="20"
>> value="<?=$value?>">
>>
>> is really not that much harder to write.
>>
>> html people can ignore it, php can find their code, and those that
>>know both
>> can reap the benefits.
>>
>> what about loops?
>
>You mean that this code
>
>
><?
>connect_to_database();
>parse_query();
>execute_query();
>
>echo "<TABLE>";
>
>while (fetch_row_from_query())
> {
> $output = data_from_fetched_row();
> $more_output = more_data_from_fetched_row();
>
> echo "<TR><TD> $output </TD><TD> $more_output
> </TD></TR>";
>
> }
>echo "</TABLE>";
>?>
>
>
>
>would be better if it were written this way? :
>
>
><?
>connect_to_database();
>parse_query();
>execute_query();
>?>
><TABLE>
><? while (fetch_row_from_query()) : ?>
>
><? $output = data_from_fetched_row();
> $more_output = more_data_from_fetched_row(); ?>
>
>
> <TR><TD><?=$output?></TD><TD><?=$more_output?></TD></TR>
>
><? endwhile; ?>
></TABLE>
>
>
>
>I _personally_ prefer the upper implementation, as all my web
>developing team (that is, only me :-) know both PHP and HTML and
>don't
>like the code to be *plagued* of <? ?> <? ?> <? ?> as in above
>example.
>
>
>
>--
>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