Stefan Walk wrote:
> Johannes Schlüter schrieb:
>> Now we have the big issue: Do we want to have short open tags forever?
>> Well, without tooo much thinking my idea would be to drop "<?" but keep
>> "<?=", "<?=" shouldn't conflict with <?xml tags in the same file, but
>> make it simple to do templating using PHP, on the other hand when not
>> echo'ing stuff you already have to write more soo the four additional
>> characters ("php ") don't matter that much - especially every decent
>> editor/ide should be able to give you a completion on that, if you want.
> 
> <ul>
> <? foreach ($items as $item): ?>
> <li><?=$item?></li>
> <? endforeach ?>
> </ul>
> 
> you can have short stuff without outputting stuff too.

I see many good reasons to disable short open tags.  However, there is a
compromise that is better from all vantage points:

<ul>
<?p foreach ($items as $item): ?>
<li><?=$item ?></li>
<?p endforeach ?>
</ul>

<?p is a valid PI and would prevent <?xml from being parsed as PHP.
Also legal is <?: as PI's can start with or contain : or _.  Honestly
though, this is not so important to me, my primary concern is the
conflict with <?xml.  I mention it out of deference for those who
actually do care about writing scripts that are xml-compliant for some
strange reason :).  Also possible and relatively simple to implement
would be to allow an = at the start of an expression to alias to T_ECHO,
so that <?p =$item ?> would work like <?=$item?>.  This is, however,
very perl-ish, so I mention it only as a possible way to preserve that
aspect of short tags for template usage.  God forbid we start seeing
regular scripts using "=" to mean "echo" :).

As a note, I use exclusively <?php in my templates and also use <?xml to
generate xhtml, so I am very much against per-script enabling of short
tag <? for the annoyance it would introduce of forcing an ini_set() at
the top of each template and the bottom as well to be a good citizen and
restore the old value.

Greg

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to