Re: [SMARTY] Using Smarty templates without php write access to server?
| From: | messju mohr | Date: | Tue, 08 Apr 2003 15:55:07 +0000 |
| Subject: | Re: [SMARTY] Using Smarty templates without php write access to server? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9192@lists.php.net to get a copy of this message | ||
On Tue, Apr 08, 2003 at 11:31:43AM -0400, Bryce Nesbitt (spam account) wrote:
> I'd like to use Smarty without offering the script write
> permission on the web server. My idea is to have the web
> designer upload the compiled Smarty templates along with
> the rest of the website. If the website does not change,
> the templates don't change, why take the risk of Smarty
> having write access to the web server?
>
> This means no cache, no temporary directory for compiled
> templates. I understand that performance would suffer.
it must not suffer. if you set $smarty->compile_check=false (which is
a good thing, if your templates_c is not writable anyway), performance
may even slightly increase.
after this, your templates aren't checked if they need recompilation,
they just get run out of templates_c (i think thats what you want).
regarding caching: you can write you own cache_handler_func that
stores your cached templates in a database (or any other data-sink)
instead of the filesystem. so there's no need to write to the
filesystem either.
there is an example on
http://smarty.php.net/manual/en/section.template.cache.handler.func.php
but if you watt to use cache_groups and clear these selectively you
have to extend the example (and your cache-table) a bit.
> Can it be done? Is it easy?
>
> -Bryce
>
> (Smarty writes and executes php,
> an operation that has some inherent risks.)
yep. no risk no fun :)