- bugfix template variables could not be passed as paramter in {include} when the include was in a {nocache} section (topic 25131)

This commit is contained in:
Uwe.Tews@googlemail.com
2014-06-21 08:53:38 +00:00
parent ee69f963c6
commit a75e36b357
2 changed files with 8 additions and 1 deletions

View File

@@ -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

View File

@@ -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 = "<?php /* Call merged included template \"" . $tpl_name . "\" */\n";
$_output .= "\$_tpl_stack[] = \$_smarty_tpl;\n";
if (!empty($nccode) && $_caching == 9999 && $_smarty_tpl->caching) {
$compiler->suppressNocacheProcessing = false;
$_output .= substr($compiler->processNocacheCode('<?php ' .$nccode . "?>\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(); ';