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

Kevin Futter kfutter at sbc.melb.catholic.edu.au
Thu Aug 31 21:24:34 MDT 2006


On 1/9/06 1:03 PM, "DC" <dan.cynosure at dbmscan.com> wrote:

> On Aug 31, 2006, at 10:22 PM, Kevin Futter wrote:
> 
>> The PHP manual itself recommends against them, and they can cause
>> all sorts of problems in XML environments, where they can (do) look
>> like an XML prolog.
> 
> True. But, the manual says that you shouldn't use them if you are
> developing libraries or code to run on other people's machines. For
> your own use on your own systems it is a good tool to have available
> - especially working with web designers.
> 
> According to the PHP manual, your comment about XML also seems to
> apply to XHTML though I am not sure why the presence of short PHP
> tags in PHP code would make a whit of difference to the validity of
> XHTML output by said code. Since you so kindly clarified the most
> recent XHTML question would you mind explaining why short tags would
> impinge on XHTML? (I understand the problem with XML)
> 

Well, if you consider that XHTML is technically a reformulation of HTML as
an application of XML, it makes more sense. Most pages that are marked up as
XHTML (even including the correct doctype) are not actually *served* or
*parsed* as XHTML, but as plain ole HTML. Why? Because the only thing that
actually determines whether a document is one or the other is its
server-supplied MIME-type header. HTML is served as text/html, whereas XHTML
has a MIME-type of application/xhtml+xml.

However, XHTML is almost never served with this MIME-type. Why? Because IE6
and below barf on it. Completely. Hence, the vast majority of the world's
web servers currently deploy text/html for XHTML to avoid this issue, making
most XHTML documents technically not XHTML at all.

So, the reason that it appears that short opening tags being confused for
XML prologs has no effect in XHTML is because most of the world's XHTML
pages ... aren't. If they were, you'd see the problem then, for sure, since
technically XHTML requires an XML prolog to pass muster. IE7 purportedly
gets this right now, so things will be changing, and there's much more to
deploying XHTML correctly than simple syntax changes.

There's more info here for those who are still curious:

http://hixie.ch/advocacy/xhtml


-- 
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