I have an issue with Smarty 2.6.9 caching, where I have a 2 templates called confirmation.tpl
which are both stored in different directories in my codebase.
However, when they are compiled they are compiled in a /cache/gb/
directory. For these two templates only I would like to prevent the compiling, and as such I have attempted to use the force_compile
member variable, however this is having no effect at all and the template is consistently cached.
The problem that this is presenting is that both confirmation.tpl
templates are being called (by separate code) on the same page, so one template is being used for both and is causing me problems.
Is there a way that I can prevent this template from being compiled and cached in this way?
I am passing a flag through to set "no_compile" for the "confirmation.tpl" template ONLY.
$this->obj = new Smarty;
$this->obj->caching = false;
$this->obj->cache_lifetime = 10;
$this->obj->compile_check = true;
$this->obj->template_dir = $this->tpl_path;
if ($this->no_compile) {
$this->obj->force_compile = false;
$this->obj->compile_check = false;
}
You can use different $compile_id
settings in display/fetch to get different physical files on disk (although I think Smarty should handle this automagically for you depending on the path). compile_id
can also be set for {include}
statements.
I'm not sure what the code you've pasted implies, but you will want to turn on force_compile
to make Smarty regenerate the template each time it is shown (it's false
by default).