views:

274

answers:

3

I work on a very high trafficked website that uses a Smarty templating system.

When I upload a fresh copy of a template that is currently being used, the page turns blank (as if there is nothing in the template file itself). I have to shut down lighttpd, upload the template again, and start lighttpd back up.

Are there any settings in Smarty that I should be utilizing that I might not be?

Here's a list of variables that I'm setting inside Smarty itself:

$smarty->use_sub_dirs = true;

$smarty->compile_check = true;

+2  A: 

you try clearing the cached files? If the file is not completely uploaded and someone requests it, it gets cached broken (at least this is what i think). I used to use smarty and i too use lighttpd. (decided to go XSLT)

if the page is being requested more than 2 times a second your never going to be able to actually update the file unless your turn the http server off. Or clear the smarty cached file.

Chad Scira
I don't think it's the real Smarty cache but the compiled templates.
Sander Marechal
A: 

You may want to turn on caching before you upload a file (if it is already on, increase the timeout and make sure that the entire template is cached). Enable the cache and set it to a couple of minutes timeout so that Smarty does not compile newly uploaded templates. Visit the page that has your template to ensure that Smarty has cached it. Then, upload the template before the cache expires. When the upload has finished you can turn caching off again (or set it back to it's original values).

You may want to add a configuration setting to your application that can globally turn on/off this caching mechanism.

Sander Marechal
+1  A: 

don't copy your templates directly, copy them in some temp folder and after upload finishes do a mv (move file operation)

codeassembly