Re: [Phplib-users] general template question
Brought to you by:
nhruby,
richardarcher
From: Richard A. <rh...@ju...> - 2001-08-14 07:54:46
|
At 12:26 AM -0700 14/8/01, Philip Strnad wrote: >the whole template processing would be negligible. So how do you do it? Are >your templates parsed dynamically? Yes, they're read in and have the content substituted on the fly. >Btw, maybe one way to speed things up would be to read the templates into >memory at server startup, but I'm not sure if this is possible in PHP? Never heard of it. Note that if you've got a busy server (and if your server isn't busy, why worry about performance ;) and the server has enough RAM, the template files will all be in cache anyway. In any event, the cost of reading in the template file is way lower than the cost of generating the dynamic content and performing the substitution. If you're using templates and databases to generate pages that are not unique *every* time (like, say a news releases page that pulls articles out of a database and is updated only every hour or so) then you can cache the built pages on disk and not even bother regenerating the dynamic content each time. You'd still need to pull a timestamp of the last inserted record out of the database but if there's no change, you can just blat out the last version of the page from cache. There was a patches that did something like this with template.inc posted by Tom Anderson to the NetUSE mailing list a long time ago. Sort of a roll-your-own Zend cache :) ...R. |