Re: [SMARTY] Using RDBMS for Smarty
| From: | messju mohr | Date: | Fri, 21 Feb 2003 12:01:16 +0000 |
| Subject: | Re: [SMARTY] Using RDBMS for Smarty | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8072@lists.php.net to get a copy of this message | ||
Hello,
On Wed, Feb 19, 2003 at 01:20:16AM +0800, Nimrod A. Abing wrote:
> Hi, I was just wondering if there is a plugin/subclass/mod for smarty
> that will allow for writing to and reading files from a RDBMS. I've read
> in the manual about using different resource reading functions for the
> templates themselves but I don't see anything that will allow you to
> read a compiled template or a cached template from a RDBMS.
>
> The main problem I've had with Smarty is the template_c directory. Most
> sensible operators don't want to make anything writable to user apache
> (or www or nobody). I've looked into the sources (2.4.2) and I think it
> would be possible to modify it to allow for a more generic approach to
> reading in the compiled and cache templates. The current implementation
> just reads in a compiled template via an include(). I've thought of a
> few ways to implement this but I just wanted to know if someone else has
> already done it before. Maybe a Smarty subclass that reads and writes
> the compiled templates from a database?
as far as i know nobody is working on such a modification.
i think the main point is, that a lot of the people using smarty do
also use phpa (http://www.php-accelerator.co.uk/) . phpa caches the
parsed php-code and can speed-up execution (read "display") of
templates tremendously. i think if you don't store your php-code in
the file-system, phpa is not (or cannot be) smart enough to cache the
parsed code. that would limit the usefulness of a
"$smarty->compiled_tpl_handler_func" significantly.
for your "sensible operator" i can say, that on a lot of setups it is
far easier to emit (nearly) arbitrary data into the underlying
database, than to illegally manipulate local files. so you wouldn't
gain that much security be disallowing templates_c.
i don't want to disencourage you in building such an extension, these
2 points are just the cons i see. a big pro would be the sake of
completeness. since smarty can handle external templates (via
ressoured) and an external cache via (via $cache_handler_func) it
would be logical to expect, that it can handle it't compiled templates
in a similar flexible way.
have fun
messju
> Best regards.