aboutsummaryrefslogtreecommitdiffstats
path: root/library/Smarty/libs/sysplugins/smarty_internal_compile_insert.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/Smarty/libs/sysplugins/smarty_internal_compile_insert.php')
-rw-r--r--library/Smarty/libs/sysplugins/smarty_internal_compile_insert.php20
1 files changed, 14 insertions, 6 deletions
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_compile_insert.php b/library/Smarty/libs/sysplugins/smarty_internal_compile_insert.php
index 4c6585543..57f273506 100644
--- a/library/Smarty/libs/sysplugins/smarty_internal_compile_insert.php
+++ b/library/Smarty/libs/sysplugins/smarty_internal_compile_insert.php
@@ -51,8 +51,11 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
- // never compile as nocache code
- $compiler->suppressNocacheProcessing = true;
+ $nocacheParam = $compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache);
+ if (!$nocacheParam) {
+ // do not compile as nocache code
+ $compiler->suppressNocacheProcessing = true;
+ }
$compiler->tag_nocache = true;
$_smarty_tpl = $compiler->template;
$_name = null;
@@ -65,7 +68,12 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
// output will be stored in a smarty variable instead of being displayed
$_assign = $_attr['assign'];
// create variable to make sure that the compiler knows about its nocache status
- $compiler->template->tpl_vars[trim($_attr['assign'], "'")] = new Smarty_Variable(null, true);
+ $var = trim($_attr['assign'], "'");
+ if (isset($compiler->template->tpl_vars[$var])) {
+ $compiler->template->tpl_vars[$var]->nocache = true;
+ } else {
+ $compiler->template->tpl_vars[$var] = new Smarty_Variable(null, true);
+ }
}
if (isset($_attr['script'])) {
// script which must be included
@@ -116,19 +124,19 @@ class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
// convert attributes into parameter array string
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
- $_paramsArray[] = "'$_key' => $_value";
+ $_paramsArray[] = "'$_key' => $_value";
}
$_params = 'array(' . implode(", ", $_paramsArray) . ')';
// call insert
if (isset($_assign)) {
- if ($_smarty_tpl->caching) {
+ if ($_smarty_tpl->caching && !$nocacheParam) {
$_output .= "echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}',{$_assign});?>";
} else {
$_output .= "\$_smarty_tpl->assign({$_assign} , {$_function} ({$_params},\$_smarty_tpl), true);?>";
}
} else {
$compiler->has_output = true;
- if ($_smarty_tpl->caching) {
+ if ($_smarty_tpl->caching && !$nocacheParam) {
$_output .= "echo Smarty_Internal_Nocache_Insert::compile ('{$_function}',{$_params}, \$_smarty_tpl, '{$_filepath}');?>";
} else {
$_output .= "echo {$_function}({$_params},\$_smarty_tpl);?>";