|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Gingy Smarty n00b
Joined: 04 Feb 2011 Posts: 2
|
Posted: Fri Feb 04, 2011 3:14 pm Post subject: Cache grouping of {include}-ed files |
|
|
Hi,
I've got a main site and a very large amount of subdomains. I'm using the same template names and structure for the main subdomain and this is the same with the ones used under the subdomains (the templates for the subdomains are stored in a different library). Not all templates are duplicated, only the different ones are (I'm using an array of template_dirs for proper template inclusion).
Now i'm suffering from cacheing problems, as I'm started to user multiple level inclusion within all the templates. The latest template overrides the cache and all sites and subdomains begins to use that cache instead of using their own ones. I've tried using a cache_id for the main display(), but it seems, this cache grouping doesn't apply to the includes within the templates.
Does anybody have any idea on how to set a cache_id, that {include} can inherit and use it properly?
Thanks in advance!
Gingy |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Feb 04, 2011 4:18 pm Post subject: |
|
|
A cache_id attached to the display() call is used only for the main template.
This is useful for caching of subtemplates which will not be dependend on a cache_id.
To use a cache_id globally use
$smarty->setCacheId('myid');
instead attching the cache_id to the display() call. |
|
Back to top |
|
Gingy Smarty n00b
Joined: 04 Feb 2011 Posts: 2
|
Posted: Mon Feb 07, 2011 10:22 am Post subject: |
|
|
U.Tews wrote: | A cache_id attached to the display() call is used only for the main template.
This is useful for caching of subtemplates which will not be dependend on a cache_id.
To use a cache_id globally use
$smarty->setCacheId('myid');
instead attching the cache_id to the display() call. |
As I can see, this option is available only in Smarty 3. Am I right? Unfortunately we are using 2.6.6 at this time (and we are not planning to upgrade). Is it possible to use a global cache_id in this version? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Feb 07, 2011 2:23 pm Post subject: |
|
|
Smarty 2:
$smarty->cache_id = $id; |
|
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
|