Re: Object oriented page templates in PHP
| From: | Tom Boutell | Date: | Mon, 09 Apr 2012 16:11:48 +0000 |
| Subject: | Re: Object oriented page templates in PHP | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59513@lists.php.net to get a copy of this message | ||
There's a reason I didn't try to kick this out as a fully formed RFC (:
The choice of @ is a nonstarter, yes. I forgot that <? is a valid
start code for PHP already so it is already valid PHP to write <?@.
And I have no solution for the nesting problem. It's just an
interesting issue; if it had a good solution PHP might be a convenient
and extensible templating language, as well as being a fast one.
I don't think an explicit syntax for this would be "magic," however
terse it might be. Calling methods implicitly like Java does, that's
magic (:
On Mon, Apr 9, 2012 at 12:03 PM, Paul Dragoonis <dragoonis@gmail.com> wrote:
> -1.
>
> PHP doesn't need more magic.
>
> On Mon, Apr 9, 2012 at 4:53 PM, Nikita Popov <nikita.ppv@googlemail.com>
> wrote:
>>
>> 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
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
--
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com