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

Smarty 2 & multicache via cache id

 
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 -> General
View previous topic :: View next topic  
Author Message
dave101ua
Smarty n00b


Joined: 23 Jan 2014
Posts: 4

PostPosted: Thu Jan 23, 2014 12:28 pm    Post subject: Smarty 2 & multicache via cache id Reply with quote

Hello

I have main.tpl and I use cache_id while displaying it as I need to show different content depending on country

Code:

$cache_id = $country_id.'|main';

$smarty->display('main.tpl', $cache_id);


main.tpl includes another templates

Code:

Main template. hello {$maintplvar}

{include file="news.tpl"}


the result is that main.tpl caches fine, I have a version of this file for each country but news.tpl does not, it has only one version for all countries, how can I do that news.tpl whicn includes inside main.tpl has country by country version too ?
is it possible to pass cache id into include plugin something like that

{include file="news.tpl" cache_id=$cache_id}

?
not sure that this is possible in Smarty2
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Thu Jan 23, 2014 2:41 pm    Post subject: Reply with quote

Just looking at what you have here, it should work as you expect. Each cache should get its own display of news.tpl. Are you sure it is not generating the same news.tpl regardless of country id? What does that tpl look like?
Back to top
View user's profile Send private message Visit poster's website
dave101ua
Smarty n00b


Joined: 23 Jan 2014
Posts: 4

PostPosted: Fri Jan 24, 2014 8:24 am    Post subject: Reply with quote

Hm,yes

I was wrong , for this example it works as expected, sorry.

I had a prob at another project with different templates structure, will try it there again.
Back to top
View user's profile Send private message
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 -> General 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