> > HTML tags require quotes, which have to be escaped in PHP, I <snip> I picked up this useful tip from another PHP newsgroup ages ago - one of those real smack your forehead moments... instead of... echo "<P class=\"foo\">bar</P>"; I use echo "<P class='foo'>bar</P>"; (note the use of single quotes) - not too sure how compatible this method is with XML ( I THINK you have uses double quotes around attribute values) - but for plain old HTML it works fine. you could use echo '<P class="foo">bar</P>"; but it makes variable replacement ugly :( echo '<P class="foo">' . $bar . '</P>'; as apposed to... echo "<P class='foo'>$bar</P>"; Hope this helps -- Richard Allsebrook Applications and Web Development "Thomas Lamy" <Thomas.Lamy@netwake.de> wrote in message 656F04F343FC25409463829A15B5FDDC08AFCB@netwake-nt.netwake.de">news:656F04F343FC25409463829A15B5FDDC08AFCB@netwake-nt.netwake.de... > Lisi [mailto:lists@shemeshdirectory.co.il] wrote: > > > > My personal test for how to do it is how much is being > > echoed. Since many > > HTML tags require quotes, which have to be escaped in PHP, I > > prefer to > > close PHP and go back into HTML. This avoids the inevitable > > bugs when I > > forget to escape the quote. If, however, I have something > > short I will > > just echo it with PHP. > I do it the same way. Additionally, if I open tags with echo, I close them > with echo, too and vice versa. This enables one to use tools like > Dreamweaver on (small) PHP pages [if one doesn't use smarty]. > > > > > There is one performance factor to consider, it's best to > > reduce opening > > and closing PHP since each time you open it there is another > > call to the > > server (I think - please correct me if I'm wrong!) which > > could in theory > > slow down your page loading, but I'm not sure how much this > > really matters. > > Anyone out there know anything about this? > It does matter, but not much. Leaving/re-entering PHP mode many times inside > a page does not use another server call, but needs memory (stack space and > PHP interpreter/bytecode structures). This can easily be bypassed by using a > PHP acellerator like the Zend Accelerator (http:///www.zend.com/) or PHP > Acellerator (http://www.php-accelerator.co.uk/). > > Thomas > > > > -Lisi > > > > At 01:30 PM 10/22/02 -0400, Chris Payne wrote: > > >Hi there everyone, > > > > > >This isn't urgent i'm just curious :-) If I want to use > > HTML code in my > > >PHP, I usually close the PHP with ?> do the HTML command > > with <?=$code?> if > > >I need to output PHP then open PHP again with <? if I need > > to write alot of > > >PHP. > > > > > >However, i've noticed alot of people use echo to output HTML > > instead of this > > >other method, which method is correct and why? I just want > > to understand if > > >I am doing it a bad way or if I should learn to adopt echo's > > for everything? > > > > > >Thanks, just curious so no hurry for a reply :-) > > > > > >Regards > > > > > >Chris Payne > > > > > > > > >-- > > >PHP Database Mailing List (http://www.php.net/) > > >To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php