Reply to Re: echo or ?><?php

Your name:

Reply:


Posted by Jeff North on 06/15/07 09:30

On Wed, 13 Jun 2007 18:23:42 -0500, in comp.lang.php "Jon Slaughter"
<Jon_Slaughter@Hotmail.com>
<V%_bi.18963$C96.11122@newssvr23.news.prodigy.net> wrote:

>| I have to output a lot of html stuff mixed with php and I'm curious if its
>| better to echo the html code or stop the php parser temporarily to got into
>| "html mode"? Is there any drawbacks to either method?
>|
>| e.g.,
>|
>| echo "<div class=\"someclass\">"
>|
>| or
>|
>| ?><div class="someclass"><?php
>|
>| (realize that this is just a simple example and is not meant to represent
>| the actual code I will be writing)

I think it would depend upon how you have your file structured.

I place most of the php processing at the top of the file an
intermingle the necessary php code within the html section.

php block
html
styles block
javascript block
body
<p class="<?php echo $x;?>">some text</p>
<select name="lbOptions">
<?php for($x=0; $x<count($records); $x++)
echo "<option value='" . $records[$i]->ID . "'>" .
$records[$i]->info . "</option>";
?>
</select>
</body>
</html>

But then again, when I'm using AJAX calls I usually have the html
embedded within the php code.

Also, using a text editor with syntax highlighting is a must.
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация