Re: [SMARTY-DEV] Bringing the {insert} functionality to other tags

From: Date: Mon, 29 Jul 2002 13:36:11 +0000
Subject: Re: [SMARTY-DEV] Bringing the {insert} functionality to other tags
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-225@lists.php.net to get a copy of this message
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. Who uses caching, and how would you implement it if you had your way? :-) Monte Ivo Jansch wrote:
Hi, Smarty has the {insert} tag for handling 'dynamic' information. I would like to specify for each tag or plugin that it is a 'dynamic tag' and should be inserted afterwards. So normal tags will be cached, but my {news} tag is handled as if it were an {insert} tag. Most generic would be if per plugin or registered function, you could specify the 'execution moment'. Pre-cache, post-cache, or postfilter. So you would actually get some kind of a multistage parser. Here's why I want 4 stages: - Compiler tags are handled at compiletime (this is already implemented) - Normal content is rendered in the second stage (normal rendering) and can be cached (this is already implemented) - Dynamic tags are handled in the third stage, after the template is fetched from the cache (this is now only implemented for the {insert} tag. - Tags that depend on all content is handled in the last stage. Example: {header} tag that renders javascript in the header that was needed by any of the other tags. Or an {lastmodified} tag that takes the last-modified date of all tags on the page (even the dynamic ones, for example, the update time of a newsitem) and renders the most recent last-modified time. What do you think? This approach also makes it absolutely transparent for the template designers what kind of tag they're using in the template. (no need to 'know' that dynamic stuff should be inserted with an {insert} tag.) I might have proposed something like this in other words before, but this time I have concrete examples. :) Considering performance, I don't think there would be a major drop. Dynamic funtions are already handled afterward, with the insert handler; it would just be a different (cleaner) way of handling it. Greetings, Ivo
-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

« previous php.smarty.dev (#225) next »