From a75e36b3570378a71ad479b406af28bed6b1cf6c Mon Sep 17 00:00:00 2001 From: "Uwe.Tews@googlemail.com" Date: Sat, 21 Jun 2014 08:53:38 +0000 Subject: [PATCH] - bugfix template variables could not be passed as paramter in {include} when the include was in a {nocache} section (topic 25131) --- change_log.txt | 2 +- libs/sysplugins/smarty_internal_compile_include.php | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/change_log.txt b/change_log.txt index 6634af43..2f60c987 100644 --- a/change_log.txt +++ b/change_log.txt @@ -20,7 +20,7 @@ - bugfix clearCompiledTemplate() did not delete files on WINDOWS when a compile_id was specified 18.04.2014 - - revert bugfix of 5.4.2015 because %-e date format is not supported on all operating systems + - revert bugfix of 5.4.2014 because %-e date format is not supported on all operating systems ===== 3.1.18 ===== (07.04.2014) 06.04.2014 diff --git a/libs/sysplugins/smarty_internal_compile_include.php b/libs/sysplugins/smarty_internal_compile_include.php index 6c114c30..4b7b09ce 100644 --- a/libs/sysplugins/smarty_internal_compile_include.php +++ b/libs/sysplugins/smarty_internal_compile_include.php @@ -216,8 +216,10 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase if (!empty($_attr)) { if ($_parent_scope == Smarty::SCOPE_LOCAL) { // create variables + $nccode = ''; foreach ($_attr as $key => $value) { $_pairs[] = "'$key'=>$value"; + $nccode .= "\$_smarty_tpl->tpl_vars['$key'] = new Smarty_variable($value);\n"; } $_vars = 'array(' . join(',', $_pairs) . ')'; } else { @@ -232,6 +234,11 @@ class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase $_hash = $compiler->smarty->merged_templates_func[$tpl_name][$uid]['nocache_hash']; $_output = "caching) { + $compiler->suppressNocacheProcessing = false; + $_output .= substr($compiler->processNocacheCode('\n", true), 6, -3); + $compiler->suppressNocacheProcessing = true; + } $_output .= " \$_smarty_tpl = \$_smarty_tpl->setupInlineSubTemplate($include_file, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_parent_scope, '$_hash');\n"; if (isset($_assign)) { $_output .= 'ob_start(); ';