Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Cache grouping of {include}-ed files

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development
View previous topic :: View next topic  
Author Message
Gingy
Smarty n00b


Joined: 04 Feb 2011
Posts: 2

PostPosted: Fri Feb 04, 2011 3:14 pm    Post subject: Cache grouping of {include}-ed files Reply with quote

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
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Feb 04, 2011 4:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
Gingy
Smarty n00b


Joined: 04 Feb 2011
Posts: 2

PostPosted: Mon Feb 07, 2011 10:22 am    Post subject: Reply with quote

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
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Feb 07, 2011 2:23 pm    Post subject: Reply with quote

Smarty 2:

$smarty->cache_id = $id;
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty Development All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP