Re: [SMARTY-DEV] Bringing the {insert} functionality to other tags
| From: | eric dot coleman at zaireweb dot com | Date: | Wed, 04 Sep 2002 17:50:03 +0000 |
| Subject: | Re: [SMARTY-DEV] Bringing the {insert} functionality to other tags | ||
| References: | 1 2 3 4 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-253@lists.php.net to get a copy of this message | ||
I have an idea...
Why not for the functions and such, define a variable say
FUNCTION_NAME_CACHE
and set it to true/false as to if you want that function to be cached when
templates are compiled.
-Eric
----- Original Message -----
From: "Monte Ohrt" <monte@ispi.net>
To: "Ivo Jansch" <ivo@ibuildings.nl>
Cc: <smarty-dev@lists.php.net>
Sent: Wednesday, September 04, 2002 11:50 AM
Subject: Re: [SMARTY-DEV] Bringing the {insert} functionality to other tags
> I'm not for certain how it will be done, I myself haven't had a whole
> lot of time to devote to it lately. First I'd like to see some things
> cleaned up in the engine. Break apart the functionality of the
> "rendering pipeline" so each piece is clearly defined. At the moment a
> lot of things are clumped together in the display() function which I'd
> like to see organized a bit better. Method calls come with a slight
> cost, so of course things must be weighed/tested/tuned. This may lead to
> things like putting the caching/compiling functionality into plugins,
> simplifying the core engine and making it easy to drop in other
> functionality.
>
> Anyways, on to caching. I have had very little thought on how caching
> would work, so I'll try it now :-) One idea (and probably most workable)
> is to cache on a function-basis. Two methods come to mind, either you
> cache nothing and register which functions get cached, or cache
> everything and register which functions _don't_ get cached (currently
> how {insert} works). Either way, no cache markup is necessary in the
> templates. If you want a particular function cached/uncached, you
> register/unregister it. This way all existing templates can support new
> caching methods without modification. Also the template functions should
> not require caching support, they should work without modification. This
> keeps the caching in an isolated layer in the template engine as well.
>
> Ok some ideas how this might work. Those of you finding these examples
> in the mailing list archives, Don't send e-mail telling me you
> cut-n-paste and they don't work. ;-)
>
> example:
>
> $this->caching = true;
> $this->register_cache_function('get_poll');
>
> or:
>
> $this->caching = false;
> $this->register_nocache_function('get_poll'); // ???
>
> Then the output of this template function would get cached (or not
cached):
>
> {get_poll id=2}
>
> Maybe an optional second parameter designates the lifetime:
>
> register_cache_function('get_poll',300);
>
> How to handle the concept of "cache none except these functions" and
> "cache all except these functions" ? I'm not sure if we should support
> one or both. If both, do we use different function names, or parameter
> values, or ? This will probably take some experimenting.
>
> Of course there are functions that wouldn't make sense to cache, and
> presumably numerous other issues to think through.
>
> Monte
>
> Ivo Jansch wrote:
> > Hi,
> >
> > a reply to a mail from a few weeks back...
> >
> > Monte Ohrt wrote:
> >
> >> I think one of the next major feature changes in Smarty is updating
> >> the caching mechanism, so now is a good time to discuss it. I like the
> >> idea of having the programmers decide which functions are not cached,
> >> as opposed to using tags in the templates.
> >
> >
> > What are your current ideas towards implementing this? Do you already
> > know how you're going to do it?
> >
> > Greetings,
> > Ivo
> >
>
>
> --
> Smarty Development Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>