Re: [SMARTY] Caching compiled non-file templates
boots <[email protected]>
| Newsgroups | gmane.comp.php.smarty.general |
|---|---|
| Message-ID | <[email protected]> |
--- Marcus Bointon <[email protected]> wrote: > A whole load of my templates are stored in a DB as part of a mailing > list management system. At present it's compiling the templates every > time they are used as there is no particular identifier (like a file > has a name) that smarty gets hold of to associate with a particular > template (unless it creates a hash from each one). The resulting > compiled and parsed output is used and then discarded - no files are > involved at any point. This is wildly inefficient - any suggestions > as to how I might make Smarty deal with this better and which bits of > Smarty I should hack about with?? Hi Marcus. Are you not using a custom resource to retrieve the templates from the db? http://smarty.php.net/manual/en/plugins.resources.php I tend to store my templates along with the features in the resource that are required: a name (as a path), the template source, a timestamp (usually via an automatically updated timestamp column) and the security level. Don't forget that if you are using MySQL then you ought use the MySql functions to convert to unix timestamps in your db query. Doing this, Smarty will be able to treat your foreign templates as if they were local and will do all the right things in terms of re-compiling on an as-needed-basis. HTH __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php