From 2e27c294b3837648bb21155124ac0cecd3b581ea Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Tue, 23 Mar 2010 16:51:48 +0000 Subject: [PATCH] - bugfix on template inheritance when calling multiple child/parent relations --- change_log.txt | 3 +++ libs/Smarty.class.php | 13 +++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/change_log.txt b/change_log.txt index 18d7647f..c158c32b 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,3 +1,6 @@ +23/03/2010 +- bugfix on template inheritance when calling multiple child/parent relations + 22/03/2010 - bugfix make directory separator operating system independend in compileAllTemplates() diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index 08837fb0..5ff44a20 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -167,7 +167,7 @@ class Smarty extends Smarty_Internal_Data { // config var settings public $config_overwrite = true; //Controls whether variables with the same name overwrite each other. public $config_booleanize = true; //Controls whether config values of on/true/yes and off/false/no get converted to boolean - public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file. + public $config_read_hidden = true; //Controls whether hidden config sections/vars are read from the file. // config vars public $config_vars = array(); // assigned tpl vars @@ -221,7 +221,8 @@ class Smarty extends Smarty_Internal_Data { // smarty object reference public $smarty = null; // block data at template inheritance - public $block_data = array(); + public $block_data = array(); + public $block_data_stack = array(); // block tag hierarchy public $_tag_stack = array(); // plugins @@ -310,6 +311,8 @@ class Smarty extends Smarty_Internal_Data { // get default Smarty data object $parent = $this; } + array_push($this->block_data_stack, $this->block_data); + $this->block_data = array(); // create template object if necessary ($template instanceof $this->template_class)? $_template = $template : $_template = $this->createTemplate ($template, $cache_id, $compile_id, $parent); @@ -352,9 +355,11 @@ class Smarty extends Smarty_Internal_Data { if ($this->debugging) { Smarty_Internal_Debug::display_debug($this); } + $this->block_data = array_pop($this->block_data_stack); return; } else { - // return fetched content + // return fetched content + $this->block_data = array_pop($this->block_data_stack); return $_output; } } @@ -707,7 +712,7 @@ class Smarty extends Smarty_Internal_Data { // Smarty 2 BC $this->_version = self::SMARTY_VERSION; return $this->_version; - } + } return null; }