Re: PHP code only allowed in XHTML 5?

Kornel On 09-07-22 15.02:

> On 22 Jul 2009, at 09:47, Daniel Glazman wrote:
>> Toby A Inkster wrote:
>>
>>> <p class="<?php echo 'foo';?>">
>>> Invalid in both XHTML and HTML, but perfectly legal PHP. PHP's start 
>>> and end markers are not real XML processing instructions. They just 
>>> look a bit like them.
>>
>> They are real processing instructions and the current PHP start marker
>> <?php was not the one early versions of PHP used. It was changed to
>> match SGML/XML PIs to allow editability in markup editors and wysiwyg
>> editors.
>>
>> Breaking that compatibility is, IMHO, a serious error.
> 
> They are not. They are just roughly similar and compatible only in most 
> basic cases.


No one is disputing that one may place things between "<?php" and 
"?>" that breaks the syntax expectations of a PI.

[...]

> Validation of PHP files cannot work reliably, it never did, and it would 
> be disservice to authors to pretend otherwise.

If the coding style is to produce valid PIs, then it is a 
disservice to prevent validation.

> 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.
-- 
leif halvard silli

Received on Wednesday, 22 July 2009 14:07:54 UTC