Re: [SMARTY] smarty and GNU gettext
[email protected] (Marcus Bointon) Tue, 30 May 2006 17:09:06 +0100
| Newsgroups | php.smarty.general |
|---|---|
| Message-ID | <[email protected]> |
On 30 May 2006, at 15:50, D_C wrote: > mean that smarty cannot pre-compile the templates? (I'm not exactly > clear how all that works, so please bear with me! I think that the > template itself is converted to a php file, then each time a page is > displayed that uses it, things go a little quicker. but if there is an > area where possibly non-static content might be passing through a > function, this would mean the conversion to php also would happen > every time?) You are confusing compiled templates and cached output. Smarty does a one-time conversion of your template syntax into straight PHP and keeps it in ./templates_c. This 'compiled' template is just regular PHP that gets run like any other script, and as such can have whatever dynamic content you like. The next step is to cache output (in ./cache) from the compiled script, which smarty does if you turn caching on ($smarty->caching = 1). This output is of course completely static, but it has almost zero overhead to deliver. Smarty can mix cached and uncached elements within a page (by including sub- templates that are cached within ones that are not, see $smarty- >caching = 2 in the docs too), so just because one part of your page is dynamic doesn't mean you have to lose out on caching altogether. That clearer? Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [email protected] | http://www.synchromedia.co.uk