From 420d37646017fd2b8af108b71953012311c87ddf Mon Sep 17 00:00:00 2001 From: andrey Date: Thu, 12 Apr 2001 13:44:19 +0000 Subject: [PATCH] *** empty log message *** --- Smarty.class.php | 2 +- Smarty_Compiler.class.php | 12 ++++++------ TODO | 2 ++ libs/Smarty.class.php | 2 +- libs/Smarty_Compiler.class.php | 12 ++++++------ 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Smarty.class.php b/Smarty.class.php index f284bfd3..09841575 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -557,7 +557,7 @@ class Smarty Purpose: called for included templates \*======================================================================*/ function _smarty_include($_smarty_include_tpl_file,$_smarty_def_vars, - $_smarty_include_vars,&$parent_smarty_config) + $_smarty_include_vars,&$_smarty_config_parent) { extract($_smarty_def_vars); extract($_smarty_include_vars); diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index 95d25a2e..2c7311eb 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -85,7 +85,7 @@ class Smarty_Compiler extends Smarty { /* TODO: speed up the following with preg_replace and /F once we require that version of PHP */ /* loop through text blocks */ - for ($curr_tb = 0; $curr_tb <= count($text_blocks); $curr_tb++) { + for ($curr_tb = 0; $curr_tb < count($text_blocks); $curr_tb++) { /* match anything within */ if (preg_match_all('!(<\?[^?]*?\?>|)!is', $text_blocks[$curr_tb], $sp_match)) { /* found at least one match, loop through each one */ @@ -329,14 +329,14 @@ class Smarty_Compiler extends Smarty { " include_once 'Config_File.class.php';\n" . "if (!is_object(\$GLOBALS['_smarty_conf_obj']) || get_class(\$GLOBALS['_smarty_conf_obj']) != 'config_file')\n" . " \$GLOBALS['_smarty_conf_obj'] = new Config_File('".$this->config_dir."');\n" . - "if (isset(\$parent_smarty_config) && $update_parent)\n" . - " \$parent_smarty_config = array_merge((array)\$parent_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file']."));\n" . + "if ($update_parent)\n" . + " \$_smarty_config_parent = array_merge((array)\$_smarty_config_parent, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file']."));\n" . "\$_smarty_config = array_merge((array)\$_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file']."));\n"; if (!empty($attrs['section'])) { - $output .= "if (isset(\$parent_smarty_config) && $update_parent)\n" . - " \$parent_smarty_config = array_merge((array)\$parent_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file'].", ".$attrs['section']."));\n" . - "\$_smarty_config = array_merge((array)\$_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file'].", ".$attrs['section']."));\n"; + $output .= "if ($update_parent)\n" . + " \$_smarty_config_parent = array_merge((array)\$_smarty_config_parent, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file'].", ".$attrs['section']."));\n" . + "\$_smarty_config = array_merge((array)\$_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file'].", ".$attrs['section']."));\n"; } $output .= '?>'; diff --git a/TODO b/TODO index 88b0733b..9702011d 100644 --- a/TODO +++ b/TODO @@ -4,3 +4,5 @@ * handle asp style tags in $php_handler * correctly capture nested php tag syntax in templates: "; ?> +* think about passing default structures to includes, i.e. {include + default=$foo}, then using $bar in included template, instead of $foo.bar diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index f284bfd3..09841575 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -557,7 +557,7 @@ class Smarty Purpose: called for included templates \*======================================================================*/ function _smarty_include($_smarty_include_tpl_file,$_smarty_def_vars, - $_smarty_include_vars,&$parent_smarty_config) + $_smarty_include_vars,&$_smarty_config_parent) { extract($_smarty_def_vars); extract($_smarty_include_vars); diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 95d25a2e..2c7311eb 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -85,7 +85,7 @@ class Smarty_Compiler extends Smarty { /* TODO: speed up the following with preg_replace and /F once we require that version of PHP */ /* loop through text blocks */ - for ($curr_tb = 0; $curr_tb <= count($text_blocks); $curr_tb++) { + for ($curr_tb = 0; $curr_tb < count($text_blocks); $curr_tb++) { /* match anything within */ if (preg_match_all('!(<\?[^?]*?\?>|)!is', $text_blocks[$curr_tb], $sp_match)) { /* found at least one match, loop through each one */ @@ -329,14 +329,14 @@ class Smarty_Compiler extends Smarty { " include_once 'Config_File.class.php';\n" . "if (!is_object(\$GLOBALS['_smarty_conf_obj']) || get_class(\$GLOBALS['_smarty_conf_obj']) != 'config_file')\n" . " \$GLOBALS['_smarty_conf_obj'] = new Config_File('".$this->config_dir."');\n" . - "if (isset(\$parent_smarty_config) && $update_parent)\n" . - " \$parent_smarty_config = array_merge((array)\$parent_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file']."));\n" . + "if ($update_parent)\n" . + " \$_smarty_config_parent = array_merge((array)\$_smarty_config_parent, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file']."));\n" . "\$_smarty_config = array_merge((array)\$_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file']."));\n"; if (!empty($attrs['section'])) { - $output .= "if (isset(\$parent_smarty_config) && $update_parent)\n" . - " \$parent_smarty_config = array_merge((array)\$parent_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file'].", ".$attrs['section']."));\n" . - "\$_smarty_config = array_merge((array)\$_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file'].", ".$attrs['section']."));\n"; + $output .= "if ($update_parent)\n" . + " \$_smarty_config_parent = array_merge((array)\$_smarty_config_parent, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file'].", ".$attrs['section']."));\n" . + "\$_smarty_config = array_merge((array)\$_smarty_config, \$GLOBALS['_smarty_conf_obj']->get(".$attrs['file'].", ".$attrs['section']."));\n"; } $output .= '?>';