Re: PHP code only allowed in XHTML 5?

Thomas Broyer On 09-07-29 23.37:

> On 7/29/09, Leif Halvard Silli <lhs@malform.no> wrote:
>> Patrick H. Lauke On 09-07-29 19.22:
>>> Leif Halvard Silli wrote:
>>>
>>>> Disagreed. But let's ignore that.  So, you are after teaching e.g.
>>>> users of WYSIWYG tools that "<?php ?>" isn't valid HTML because it
>>>> isn't a PI. A convoluted message.
>>> But at that point the users aren't writing/authoring HTML, they're
>>> authoring PHP?
>>
>> Sorry, but I'm not sure what you are trying to say.

 >

> [Replying from a phone, sorry for the bad quoting]
> 
> When you're coding php, you're authoring a program that outputs html,
> you're not actually authoring html. It just appears that in php,
> everything outside <?php ?> is output literally. So validating your
> php program as html is an error. I think that's what Philip was
> saying.

(Patrick, I guess.)

As you know, how the page is read by the server or by the UA, 
depends on the  MIME type. Thus, just because you insert PHP code, 
it doesn't become a PHP file. And since most UAs by default will 
treat "file:///file.php" as a plain text file, you may have to use 
extension .htm or .html if you want to render/test/edit a page 
with PHP code inside in a UA/WYSIWYG editor.

A page containing javascript may also not be correctly tested, as 
we do not currently have validators that test the DOM instead of 
the code. Today, with HTML 4, we then have the oddity that all 
strings of "</" inside the script element, must be escaped if you, 
still, would like to validate your web page - whatever use you may 
find in doing so.

Since you do not find any use of validating un-processed HTML 
pages if they contain PHP, then I suppose you do not find any use 
in validating pages with JavaScript either. But, others apparently 
want to validate pages with embedded javascript, and for their 
convenience, HTML 5 has removed one obstacle - you do not have to 
escape the "</" string anymore - it validates anyhow.

Horray! Or? Couldn't this have the negative effect that authors 
starts to insert code directly in the SCRIPT element instead of 
using SRC to link to a javascript file instead? I guess that you, 
and/or others, who have spoken about "better ways" to do it, would 
be against this simplification of the SCRIPT element also? No?

If not, then, I again, wonder, why, when it has become simpler to 
use SCRIPT, it should become more difficult, yeah - simply 
illegal, to use <? >. I find no logic in that. Instead, on should, 
if possible, make it simpler to use <? >.
-- 
leif halvard silli

Received on Thursday, 30 July 2009 16:11:06 UTC