mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-18 15:05:19 +02:00
- bugfix on {foreach} and {for} optimizations of 27/04/2010
This commit is contained in:
@@ -28,10 +28,6 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase {
|
||||
// check and get attributes
|
||||
$_attr = $this->_get_attributes($args);
|
||||
|
||||
$this->_open_tag('foreach', array('foreach', $this->compiler->nocache));
|
||||
// maybe nocache because of nocache variables
|
||||
$this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache;
|
||||
|
||||
$from = $_attr['from'];
|
||||
$item = $_attr['item'];
|
||||
|
||||
@@ -41,6 +37,10 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase {
|
||||
$key = null;
|
||||
}
|
||||
|
||||
$this->_open_tag('foreach', array('foreach', $this->compiler->nocache, $item, $key));
|
||||
// maybe nocache because of nocache variables
|
||||
$this->compiler->nocache = $this->compiler->nocache | $this->compiler->tag_nocache;
|
||||
|
||||
if (isset($_attr['name'])) {
|
||||
$name = $_attr['name'];
|
||||
$has_name = true;
|
||||
@@ -153,8 +153,8 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase {
|
||||
// check and get attributes
|
||||
$_attr = $this->_get_attributes($args);
|
||||
|
||||
list($_open_tag, $nocache) = $this->_close_tag(array('foreach'));
|
||||
$this->_open_tag('foreachelse', array('foreachelse', $nocache));
|
||||
list($_open_tag, $nocache, $item, $key) = $this->_close_tag(array('foreach'));
|
||||
$this->_open_tag('foreachelse', array('foreachelse', $nocache, $item, $key));
|
||||
|
||||
return "<?php }} else { ?>";
|
||||
}
|
||||
@@ -181,7 +181,11 @@ class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase {
|
||||
$this->compiler->tag_nocache = true;
|
||||
}
|
||||
|
||||
list($_open_tag, $this->compiler->nocache) = $this->_close_tag(array('foreach', 'foreachelse'));
|
||||
list($_open_tag, $this->compiler->nocache, $item, $key) = $this->_close_tag(array('foreach', 'foreachelse'));
|
||||
unset($compiler->local_var[$item]);
|
||||
if ($key != null) {
|
||||
unset($compiler->local_var[$key]);
|
||||
}
|
||||
|
||||
if ($_open_tag == 'foreachelse')
|
||||
return "<?php } ?>";
|
||||
|
Reference in New Issue
Block a user