Re: PHP code only allowed in XHTML 5?

Anne van Kesteren On 09-07-22 12.53:

> On Wed, 22 Jul 2009 12:42:01 +0200, Leif Halvard Silli wrote:
>> Thomas Broyer On 09-07-22 12.03:
>>> on at least Firefox and Opera: try it with <?php echo
>>> "hello <b>world</b>!"; ?>)

 >>

>> So it ends with the ">" in "<b>". Where is the news? UAs
>> support the SGML/HTML PI syntax - that is why it works like
>> this - and it is also in accordance with how the W3 validator
>> sees it.
> 
> I guess the news is that the above example would work in XML.

And for UAs supporting XML, it works there as well. Yes, when the 
code directly embeds HTML elements, then the XML PI syntax is more 
meaningful than the HTML syntax.

> I agree with Simon that if you want stuff like this to work
> dedicated editor support is needed (and there is to some
> extent) and potentially modified validators. This does not e.g.
> work for Python


What does 'this does not work for Python' mean? That Python uses 
another embedding syntax? But the syntax is up to Python to decide 
and not an argument against those languages that consciously have 
chosen the PI syntax.

> and also does not work in common PHP scenarios
> such as
> 
> <div<?php if($foo) { echo " class='bar'"; }?>>


But since we are talking HTML and not XHTML, you could use

     <div class=' <?php if($foo) { echo " bar"; }?>' >

and be valid.

 
> et cetera.

As the HTML 5 draft says: What is possible to do in the DOM vs in 
text/HTML vs XHTML etc, may differ.
-- 
leif halvard silli

Received on Wednesday, 22 July 2009 11:49:22 UTC