|
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 |
Anton Gridasov Smarty n00b
Joined: 26 Jan 2018 Posts: 3
|
Posted: Fri Jan 26, 2018 11:34 am Post subject: Smarty3 Subtemplates caching is too aggressive |
|
|
Our project has different language versions of templates for different domains, some of them are identical so we use includes:
en_DE/welcome.tpl:
en_EU/welcome.tpl:
Code: | {include file="en_DE/welcome.tpl"} |
When template en_EU/welcome.tpl is rendered more then one time during run session, subtemplate en_DE/welcome.tpl is cached. If we try to render subtemplate directly we got cached version.
Code: | <?php
require '../libs/Smarty.class.php';
$smarty = new Smarty;
$smarty->caching = false;
$smarty->assign('user', 'Alex');
$result = $smarty->fetch('en_EU/welcome.tpl');
$result = $smarty->fetch('en_EU/welcome.tpl');
echo $result . "\n";
// Welcome Alex
$smarty->assign('user', 'Tom');
$result = $smarty->fetch('en_DE/welcome.tpl');
echo $result . "\n";
// Welcome Alex
|
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sat Jan 27, 2018 12:03 pm Post subject: |
|
|
You can use compile_id when you want to build two template sets from one template source.
Different compile_id's are cached separately. |
|
Back to top |
|
Anton Gridasov Smarty n00b
Joined: 26 Jan 2018 Posts: 3
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Jan 28, 2018 11:40 am Post subject: |
|
|
Oh, good to know. Didn't experience this issue myself. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
Anton Gridasov Smarty n00b
Joined: 26 Jan 2018 Posts: 3
|
Posted: Sun Jan 28, 2018 2:03 pm Post subject: |
|
|
Is it final stable version 3.1.31?
Download page contains link to release 3.1.30 https://www.smarty.net/download
And release 3.1.31 marked with comment 'prepare 3.1.31 release'
I'm a bit confused which version to use for production |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Jan 28, 2018 4:37 pm Post subject: |
|
|
Did I say "3.1.31 release"? |
|
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
|