[FX.php List] Embed php into HTML or vice versa?

Kevin Futter kfutter at sbc.melb.catholic.edu.au
Thu Aug 31 17:29:07 MDT 2006


On 1/9/06 6:16 AM, "Jonathan Schwartz" <jonathan at eschwartz.com> wrote:

> I'd like to get better at coding my scripts.
> 
> One thing that I have not developed a sense for yet: when it is best
> to embed php tags into html versus embedding html into php code.
> 
> I tend to waste the most amount of time solving parse errors when
> embedded html into php, it seems, especially in dealing with quotes
> and such.
> 
> I hope that this question makes sense.
> 
> Thanks
> 
> Jonathan
> 

The way to look at it is from the perspective of separating logic from other
elements of page rendering (document structure, presentation and behaviour).
On that basis alone, I endeavour to keep my PHP and HTML as separate as
possible (which often isn't very). Normally I try to just print PHP variable
values into an HTML element or attribute and move on. It's not always
possible, but mixing them up either way just makes for a messy document in
which all the separate elements are mashed up.

-- 
Kevin Futter
Webmaster, St. Bernard's College
http://www.sbc.melb.catholic.edu.au/



------------------------------------------
This e-mail and any attachments may be confidential.  You must not disclose or use the information in this e-mail if you are not the intended recipient.  If you have received this e-mail in error, please notify us immediately and delete the e-mail and all copies.  The College does not guarantee that this e-mail is virus or error free.  The attached files are provided and may only be used on the basis that the user assumes all responsibility for any loss, damage or consequence resulting directly or indirectly from the use of the attached files, whether caused by the negligence of the sender or not.  The content and opinions in this e-mail are not necessarily those of the College.




More information about the FX.php_List mailing list