Hi Ralph, Pierre, everybody,

Am Samstag, den 22.03.2008, 01:23 +0100 schrieb Pierre Joye:
> On Sat, Mar 22, 2008 at 12:51 AM, Ralph Schindler <[EMAIL PROTECTED]> wrote:
> >
> >  > Take this file:
> >  >
> >  > <?xml version="1.0" encoding="utf-8" ?>
> >  > <foo>
> >  > <? echo "bar"; ?>
> >  > </foo>
> >  >
> >  > and run it through xmllint.

That's exactly the point, thanks Ralph. It makes absolutely no sense
validating XML documents containing PHP instructions *before* the
instructions have been processed as the instructions may - obviously -
change the state of the document (e.g. . So a much more sensible QA
practice is to generate the process the template and validate it after
processing (at least in the development stage). At this time, no matter
which tags have been used, and only at this time, it is possible to
determine whether a document can be counted valid or not.

Example 1 (not valid before processing):
<test>
    <element value="<?php echo htmlentities($foo);?>"/>
</test>

Example 2 (valid before processing but not after):
<test>
    <?php echo "<element/>";?>
</test>

Example 3 (valid before an after processing):
<test>
    <element><?php echo htmlentities($value);?></element>
</test>

I've picked three random use cases. Only one of them can be successfully
validated before processing.
Rasmus pointed it out before, people are using short tags, because they
want to save keystrokes and increase readability. More verbose code
(using temporary variables, etc. pp.) might be better in business logic
but the quality of a template rises and sinks with the size of its
instructions. This is why people do use Smarty ({foreach from=$array
item=item} is shorter than <?php if (isset($array) and is_array($array))
{ foreach ($array as $item) { ... }}) and similiar template engines.
Providing the infrastructure to enable/disable short tags per runtime
allows people to better define their API, in this case the API for
templating as they can define "the only point where one may use short
tags, are the templates". Currently, if people want short tags, and they
want to use it (see Solar_View or Zend_View from the Solar resp. Zend
Framework), the only way to use short tags is to globally enable them.
So please, just leave the patch in, and do not use short tags, if you
dislike them.

cu, Lars

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to