|
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 |
dave101ua Smarty n00b
Joined: 23 Jan 2014 Posts: 4
|
Posted: Thu Jan 23, 2014 12:28 pm Post subject: Smarty 2 & multicache via cache id |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Jan 23, 2014 2:41 pm Post subject: |
|
|
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 |
|
dave101ua Smarty n00b
Joined: 23 Jan 2014 Posts: 4
|
Posted: Fri Jan 24, 2014 8:24 am Post subject: |
|
|
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 |
|
|
|
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
|