Re: [PHP Template] cached templates...
[email protected] (Andrei Zmievski) Wed, 1 Mar 2000 08:43:10 -0600
| Newsgroups | php.template |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 01 Mar 2000, [email protected] wrote: > Hello, > > Could someone give a brief explanation on how the cached templates logic > will work? I have read what the Rev. 0.37 Specs. have to say about it, > just looking for more discussion on it. I'll try to explain what I refer to as 'caching'. When the engine loads a template file, it needs to parse through it and construct an intermediate in-memory representation. When you later assign variables and do tmpl_fetch(), it walks through this intermediate representation, filling in values, looping sections, etc. and then returns the result. So, unless template file changes on the drive, it's not necessary to have the parsing stage done each time and thus this intermediate representation can be cached in memory so that only the second stage is necessary each time. > I am wondering if it will be possible to cache sections (not sure if > this makes sense), or would this be done best by using the > {{include some_template}} > command? I'm thinking that if each page on a site has a navagation bar > that is generated from some db info but it only changes once a day then > will that need to be in its own template file in order to be cached? I > assume so. I see that you want to actually cache the template output for some time. I suppose we can allow for that, it'd have to be a separate setting that says how long to cache the template output for. Since we'd have two kinds of caching, I'm not sure what would be good names for each one then. -Andrei * "UNIX, isn't that some archaic form of DOS?" - our job applicant *