From 1ee07478017267af924aa0058ceea6d0b3e344fa Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Thu, 23 Apr 2009 13:32:45 +0000 Subject: [PATCH] - fixed access of special smarty variables from included template --- change_log.txt | 3 +++ libs/sysplugins/internal.compile_foreach.php | 1 + libs/sysplugins/internal.compile_section.php | 1 + libs/sysplugins/internal.template.php | 1 - 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/change_log.txt b/change_log.txt index 2a2dc2de..a2ece6e3 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,6 @@ +04/23/2009 +- fixed access of special smarty variables from included template + 04/22/2009 - unified template stream syntax with standard Smarty resource syntax $smarty->display('mystream:mytemplate') diff --git a/libs/sysplugins/internal.compile_foreach.php b/libs/sysplugins/internal.compile_foreach.php index 207762f1..be701187 100644 --- a/libs/sysplugins/internal.compile_foreach.php +++ b/libs/sysplugins/internal.compile_foreach.php @@ -56,6 +56,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase { $output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['total'] = \$_smarty_tpl->tpl_vars[$item]->total;\n"; $output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['iteration']=0;\n"; $output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['index']=-1;\n"; + $output .= " \$_smarty_tpl->tpl_vars['smarty']->scope = 0;\n"; } $output .= "if (count(\$_from) > 0){\n"; $output .= " foreach (\$_from as \$_smarty_tpl->tpl_vars[$item]->key => \$_smarty_tpl->tpl_vars[$item]->value){\n"; diff --git a/libs/sysplugins/internal.compile_section.php b/libs/sysplugins/internal.compile_section.php index 6ee852d7..5642f2a2 100644 --- a/libs/sysplugins/internal.compile_section.php +++ b/libs/sysplugins/internal.compile_section.php @@ -34,6 +34,7 @@ class Smarty_Internal_Compile_Section extends Smarty_Internal_CompileBase { $section_name = $_attr['name']; $output .= "unset(\$_smarty_tpl->tpl_vars['smarty']->value['section'][$section_name]);\n"; + $output .= "\$_smarty_tpl->tpl_vars['smarty']->scope = 0;\n"; $section_props = "\$_smarty_tpl->tpl_vars['smarty']->value['section'][$section_name]"; foreach ($_attr as $attr_name => $attr_value) { diff --git a/libs/sysplugins/internal.template.php b/libs/sysplugins/internal.template.php index 2671f8b8..d711702f 100644 --- a/libs/sysplugins/internal.template.php +++ b/libs/sysplugins/internal.template.php @@ -90,7 +90,6 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase { $this->security = $this->smarty->security; $this->cache_resource_class = 'Smarty_Internal_CacheResource_' . ucfirst($this->caching_type); $this->parent = $_parent; - $this->tpl_vars['smarty'] = new Smarty_Variable; // Template resource $this->template_resource = $template_resource; // parse resource name