Re: Object oriented page templates in PHP
| From: | Matthew Weier O'Phinney | Date: | Mon, 09 Apr 2012 17:49:10 +0000 |
| Subject: | Re: Object oriented page templates in PHP | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-59524@lists.php.net to get a copy of this message | ||
On 2012-04-09, Tom Boutell <tom@punkave.com> wrote:
> 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 <?@.
Another tack to take is to use PHP's streams support. We did this in
ZF's Zend_View at one point to emulate short tags when they're disabled.
Basically, it allows you to pre-process the template file as it's being
included.
The downside is, of course, performance. However, you could very easily
add a caching layer to this as well to cache the modified code so that
subsequent calls do not have to do the pre-processing.
Basically, I think this is something that can be accomplished in
userland.
--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc