From efd4ed83b57b376238eb50e99308219ea746846a Mon Sep 17 00:00:00 2001 From: messju Date: Sun, 20 Apr 2003 13:04:42 +0000 Subject: [PATCH] added &$repeat-paramter to block-functions --- NEWS | 1 + libs/Smarty_Compiler.class.php | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 136160b5..d92094c3 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ + - added &$repeat-paramter to block-functions (messju) - enabled hex-constants in function.math.php (messju) - enabled hex-constants (0x...) as function-attributes, inside if-statements and as modifier-parameters (messju) diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index fce49215..d7efef67 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -646,14 +646,16 @@ class Smarty_Compiler extends Smarty { $arg_list[] = "'$arg_name' => $arg_value"; } - $output = "_tag_stack[] = array('$tag_command', array(".implode(',', (array)$arg_list).")); ".$this->_compile_plugin_call('block', $tag_command).'(array('.implode(',', (array)$arg_list)."), null, \$this); ob_start(); ?>"; + $output = "_tag_stack[] = array('$tag_command', array(".implode(',', (array)$arg_list).')); '; + $output .= $this->_compile_plugin_call('block', $tag_command).'(array('.implode(',', (array)$arg_list).'), null, $this, $_block_repeat=true);'; + $output .= 'while ($_block_repeat) { ob_start(); ?>'; } else { - $output = "_block_content = ob_get_contents(); ob_end_clean(); "; - $out_tag_text = $this->_compile_plugin_call('block', $tag_command)."(\$this->_tag_stack[count(\$this->_tag_stack)-1][1], \$this->_block_content, \$this)"; - if($tag_modifier != '') { - $this->_parse_modifiers($out_tag_text, $tag_modifier); - } - $output .= 'echo ' . $out_tag_text . ';'; + $output = '_block_content = ob_get_contents(); ob_end_clean(); '; + $_out_tag_text = $this->_compile_plugin_call('block', $tag_command).'($this->_tag_stack[count($this->_tag_stack)-1][1], $this->_block_content, $this, $_block_repeat=false)'; + if ($tag_modifier != '') { + $this->_parse_modifiers($_out_tag_text, $tag_modifier); + } + $output .= 'echo '.$_out_tag_text.'; } '; $output .= " array_pop(\$this->_tag_stack); ?>"; } @@ -1821,7 +1823,6 @@ class Smarty_Compiler extends Smarty { } } - /** * load pre- and post-filters */