diff options
Diffstat (limited to 'library/Smarty/libs/sysplugins/smarty_internal_compile_assign.php')
-rw-r--r-- | library/Smarty/libs/sysplugins/smarty_internal_compile_assign.php | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/library/Smarty/libs/sysplugins/smarty_internal_compile_assign.php b/library/Smarty/libs/sysplugins/smarty_internal_compile_assign.php index 0ac3f68ce..caa34861f 100644 --- a/library/Smarty/libs/sysplugins/smarty_internal_compile_assign.php +++ b/library/Smarty/libs/sysplugins/smarty_internal_compile_assign.php @@ -1,28 +1,28 @@ <?php /** * Smarty Internal Plugin Compile Assign - * * Compiles the {assign} tag * - * @package Smarty + * @package Smarty * @subpackage Compiler - * @author Uwe Tews + * @author Uwe Tews */ /** * Smarty Internal Plugin Compile Assign Class * - * @package Smarty + * @package Smarty * @subpackage Compiler */ -class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase { - +class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase +{ /** * Compiles code for the {assign} tag * - * @param array $args array with attributes from parser - * @param object $compiler compiler object - * @param array $parameter array with compilation parameter + * @param array $args array with attributes from parser + * @param object $compiler compiler object + * @param array $parameter array with compilation parameter + * * @return string compiled code */ public function compile($args, $compiler, $parameter) @@ -39,7 +39,11 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase { if ($compiler->tag_nocache || $compiler->nocache) { $_nocache = 'true'; // create nocache var to make it know for further compiling - $compiler->template->tpl_vars[trim($_attr['var'], "'")] = new Smarty_variable(null, true); + if (isset($compiler->template->tpl_vars[trim($_attr['var'], "'")])) { + $compiler->template->tpl_vars[trim($_attr['var'], "'")]->nocache = true; + } else { + $compiler->template->tpl_vars[trim($_attr['var'], "'")] = new Smarty_variable(null, true); + } } // scope setup if (isset($_attr['scope'])) { @@ -72,13 +76,11 @@ class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase { } elseif ($_scope == Smarty::SCOPE_ROOT || $_scope == Smarty::SCOPE_GLOBAL) { $output .= "\n\$_ptr = \$_smarty_tpl->parent; while (\$_ptr != null) {\$_ptr->tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]]; \$_ptr = \$_ptr->parent; }"; } - if ( $_scope == Smarty::SCOPE_GLOBAL) { + if ($_scope == Smarty::SCOPE_GLOBAL) { $output .= "\nSmarty::\$global_tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]];"; } $output .= '?>'; + return $output; } - } - -?>
\ No newline at end of file |