Re: [SMARTY] Using RDBMS for Smarty

From: Date: Fri, 21 Feb 2003 15:13:36 +0000
Subject: Re: [SMARTY] Using RDBMS for Smarty
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-8081@lists.php.net to get a copy of this message
If you pull PHP code from a database you would have to eval() it which is significantly slower than including off a file system, not to mention the SQL query overhead. You're much better off figuring out how to write out files IMHO. Monte On Fri, 2003-02-21 at 06:01, messju mohr wrote: > 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. -- Monte Ohrt <monte@ispi.net>

« previous php.smarty.general (#8081) next »