Re: PHP code only allowed in XHTML 5?

Kornel Lesinski On 09-07-22 20.41:

> On Wed, 22 Jul 2009 15:07:12 +0100, Leif Halvard Silli:
> 
>> No one is disputing that one may place things between "<?php" and "?>" 
>> that breaks the syntax expectations of a PI.
> 
> This means it's not PI and should not be parsed as such.


Not sure what it means. May be it means that the PI syntax of HTML 
ought to be changed to be more like that of XML. Then it would be 
possible to place ">" inside the PI without tricks.

"<?php etc" _is_ parsed like a PI, anyhow - see the discussion 
between me and Thomas.

> It's so far from being SGML/XML, that even Smarty syntax is going to 
> validate in more cases and give you more accurate validation results.
> 
>> If the coding style is to produce valid PIs, then it is a disservice 
>> to prevent validation.
> 
> This style renders PHP nearly useless, 


The PHP developers probably chose <?php ?> due to another 
conclusion ...

> and even then is far from 
> guaranteeing that output is actually going to be valid or even well-formed.
> 
>>> If you want to ensure that code PHP generates is valid/well-formed, I 
>>> suggest using templating engine for PHP that doesn't break XML 
>>> syntax, for example PHPTAL or OPT 2.0.
>>
>> The unparsed PHPTAL and OPT 2.0 syntax is not valid HTML 5.
> 
> However it is well-formed in all cases (which cannot be said about PHP), 
> and for PHPTAL there is a DTD based on XHTML DTD that allows you to 
> validate templates with W3C Validator, with much better accuracy and far 
> less limitations than PHP-as-PI:
> 
> http://www.mail-archive.com/phptal@lists.motion-twin.com/msg00806/xhtml1-strict-phptal.dtd 

This is certainly very interesting and practical - thanks for the 
info. But not an argument against PIs, IMHO.
-- 
leif halvard silli

Received on Thursday, 23 July 2009 00:32:40 UTC