- From: Kornel <kornel@geekhood.net>
- Date: Wed, 19 May 2010 12:04:50 +0100
- To: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
- Cc: public-html@w3.org
On 19 May 2010, at 10:17, Daniel Glazman wrote: > Henri... Nobody's editing html with php inside through a http pipe. Probably not, but at least TextMate supports live preview of documents piped through PHP. > It's local storage and your comment does not stand here. > > From a web author's perpective, the fact that a html instance containing > a php PI won't be editable as a polyglot document is a severe limiting > factor to the usefulness of polyglot documents. Could you show real-life nontrivial PHP project that has PHP templates editable as HTML or XML? I have not seen it, and I doubt there is such, because common PHP construct makes it impossible: <html <?php /* this is parsed as PHP block, but it can't even be expressed in DOM */ ?>> PHP blocks are not PIs, and to parse them correctly you need PHP tokenizer, e.g. <?php echo '?>'; /* still not closed - that's how you output XML PI in PHP */ ?>. Only subset of specifically crafted PHP documents is passable as HTML or XML with PIs, but PHP-as-PI is very different from typical PHP code. And even if someone took extra effort to write templates in this specific way, such templates would still be hard to edit in PHP-unaware tools. XML/HTML editor wouldn't know that <?php foreach() { ?> and <?php } ?> are equivalent of start and end tags and have to be appropriately handled when adding/moving elements in the document. PHP developers wishing to use WYSIWYG tools to edit dynamic templates can use PHPTAL or OPT template engines, which use well-formed XML and the former is specifically designed for that purpose. If editing of HTML mixed with PHP is desireable, someone might write editor speficically for this purpose. HTML spec doesn't apply to PHP editors, so we don't have to worry about that case. I think compatibility with PHP syntax should not be a goal for HTML. PHP is embeddable in all kinds of documents (it's possible to create polyglot GIF/PHP file), and PHP parser doesn't even attempt to parse PHP in way compatible with HTML or XML. PHP has it's own, incompatible sytnax that is only superficially similar to PIs in contrived cases. -- regards, Kornel
Received on Wednesday, 19 May 2010 11:05:37 UTC