Re: Object oriented page templates in PHP
| From: | Nikita Popov | Date: | Mon, 09 Apr 2012 15:53:09 +0000 |
| Subject: | Re: Object oriented page templates in PHP | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59510@lists.php.net to get a copy of this message | ||
On Mon, Apr 9, 2012 at 5:10 PM, Tom Boutell <tom@punkave.com> wrote:
> What if PHP supported a short tag for calling a method of $this?
>
> Then one could write:
>
> <?@escape($foo) ?>
A big -1 on this.
If you want to roll your own template syntax, just do so. It's not
that hard to run a quick str_replace('<?@', '<?php echo $this->',
$code) over the template.
Especially consider that @ is already used for error suppression, so
code that previously just wanted to suppress some errors will suddenly
try to call class methods (which obviously will lead to fatal errors).
Nikita