> <ul>
> <?php foreach ( $things as $thing ) { ?>
> <li><a href="/things/<?= $thing['name'] ?>" onclick="show_popup('<?=
> $thing['name'] ?>');"><?= $thing['name'] ?></a>
> <?php } ?>
> </ul>
>
> There are three different escape mechanism needed there; if there is a
> shorthand for one, do you think it will be more likely or less that people
> will get the other two right?

I have to agree with that - assigning special syntax to one kind of
escape-function gives that function an elevated status, which could
easily encourage neglect and oversight.

I do wish that we had an obvious, consistently-named set of
web-related escape/encode functions for use in plain PHP templates,
like html(), attr(), js(), etc... having to type and read
htmlspecialchars() and json_encode() while you're trying to visually
parse a template is really inconvenient.

That's all it is though, inconvenience. Nice to have, not must have.

I'd be much more interested in a general solution to the problem of
being unable to (or at least strongly demotivated from) using actual
namespaced functions in this and many other cases - that's a missing
feature and a more general problem, whereas in my opinion an operator
or shorter function-names are just a work-around...

(and please, nobody say "use a template engine" - I *am* using a
template engine, it's called PHP!)

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

Reply via email to