Re: [htmltmpl] RFC: Conditional TMPL_INCLUDE
Brought to you by:
samtregar
From: Mark F. <mar...@ea...> - 2005-01-07 19:03:44
|
From: "Sam Tregar" <sa...@tr...> > On Fri, 7 Jan 2005, Mark Fuller wrote: > > However, if you think it would be useful to have a "persistent evaluation" > > of the *cached* template (so that the partially-evaluated template is > > returned with each subsequent "new" method calls), I hope you'll keep it in > > mind if/when H::T is enhanced. > > Why? I still haven't heard a compelling use-case aside from dynamic > includes which I think can be handled in better ways. Ooops. We're talking about two different things. What I said above concerns evaluation of a template which needs to be performed *only once*. For example: let's say a template's title, headings, field captions, etc., are generated using Locale::Maketext (to get a foreign language). The template is evaluated to get this language-specific text into the template. It wouldn't make sense to have to re-evaluate all this stuff for each re-display of the page (in this language). That's why I said that I "new" the same template (as needed for a language) into a hash keyed by language. This way I have one template for each language. The problem is: each time I "new" it (for each redisplay) I loose all the one-time evaluation performed upon the template. I need these one-time evaluations cached. I can perform my own caching, but then I have to take steps concerning the state of non-one time evaluations and make sure I don't take anything for granted. I can't get a fresh copy of the template as it existed at the time I performed my one-time evaluations. I also have to perform my own test of whether the template changed so I can discard my cached copy. Does that sound like a reasonable usage? Thanks! Mark |