- From: Leif Halvard Silli <lhs@malform.no>
- Date: Wed, 22 Jul 2009 11:30:43 +0200
- To: HTMLWG <public-html@w3.org>
Smylers On 09-07-22 07.01: > Leif Halvard Silli writes: > >> Suppose one wants to validate a page that embeds PHP, but that one >> wants to do so /prior/ to the execution of the PHP script: >> >> <?php Print "Hello, World!"; ?> > > How can that be a meaningful thing to do? Well, for instance, you can use it to check that you added PHP inside <? ?> - that you added it correctly. And if you find that your end-result page doesn't validate, you can use it to look for the errors: Does the error before PHP is executed or not? > What if the PHP script emits > something which causes an error, such as misnested tags? The > conformance checker would be giving the author the impression that the > page is conforming, yet what gets sent to the browser clearly isn't. If this is an issue that a validator engine should think about, then it should be through warning message saying that the page may not be valid /after/ the PHP code has been executed. (But then, what about /any/ form that updates the page - should the validator tell the author that the page might become invalid once readers have use the form?) > And why should PHP have this ability and not other programming or > templating languages, such as those which use <% ... %> or [% ... %]? What an upside down question ... The PHP and the Biferno language have chosen to use the <?instruction ?> syntax, thereby using a format that is defined in HTML and XHTML and supported by UAs. In many other programming languages, the author can change the syntax to his/her liking - which is the way to achieve "justice", in this case. Otherwise, if you use <%...%> and [%...%], then the code becomes visible in the browser. And this might be what you want. So it depends on your coding style preferences. It would be stupid to say that <% and <? should be treated the same. For instance, some PHP templating languages uses visible rendered syntax instead of <? ?> syntax. > If this is deemed a useful feature there's nothing stopping a > conformance checker developer providing an option for 'strip PHP tags', > which could be implemented as a pre-processing step to passing the > remaining content to an HTML 5 parser. Or indeed for any other template > syntax, regardless of whether it resembles SGML processing instructions. > But doing so doesn't require the language itself to be warped to allow > this. <? > doesn't warp HTML. Do we want the anomaly that <?php ... ?> is valid XHTML 5, but invalid HTML 5? What about the UA support, should it be ignored? What about current validators - Validator.w3.org and HTML Tidy? And so on. Should we pretend that support for <? > doesn't exist? -- leif halvard silli
Received on Wednesday, 22 July 2009 09:31:23 UTC