 |
Smarty
The discussions here are for Smarty, a template engine for the PHP programming language. Dedicated server web hosting provided by Guru-host.eu. |
| View previous topic :: View next topic |
| Author |
Message |
adn Smarty Regular
Joined: 31 May 2011 Posts: 47
|
Posted: Thu Mar 29, 2012 1:47 pm Post subject: caching to false and include + cache_lifetime |
|
|
Hello,
I have replaced some "include + inline" by "include + cache_lifetime" and I am surprised when using caching mode to false that my template are not refreshed. If I go back with this modification the refresh is done.
Is that a normal behavior? I thought that even if I put a cache_lifetime attribute the include should be refreshed.
What's wrong? |
|
| Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 4200 Location: Hamburg / Germany
|
Posted: Thu Mar 29, 2012 4:29 pm Post subject: |
|
|
If you use the cache_lifetime attribute with the {include} tag that subtemplate gets cached with it's individual lifetime independent from any global cache setting of the Smarty object.
So with $smarty->caching = false; the content of the main template is not cached but the content {include ... cache_lifetime = ...} subtemplate is.
To disable caching of single subtemplates when caching is globally on use {include .... nocache} |
|
| Back to top |
|
adn Smarty Regular
Joined: 31 May 2011 Posts: 47
|
Posted: Thu Mar 29, 2012 5:10 pm Post subject: |
|
|
| Is there a way to say "nocache" for the template and all subtemplate? I have a debugging mode where I put $smarty->caching = false; to test an enhancement or to do some test. It is quite difficult to modify all the includes in template for that. |
|
| Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 4200 Location: Hamburg / Germany
|
Posted: Thu Mar 29, 2012 7:27 pm Post subject: |
|
|
Note that you must use {include ... cache_lifetime = ...} only for subtemplates which shall have a lifetime different from the main or calling template.
If you want to cache the whole page with no different lifetime for the subtemplates use a simple {include} otherwise you loose performance.
You can't disable caching of subtemplates which have {include ... cache_lifetime = ...} |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|