mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-07 03:44:26 +02:00
- fixed {foreachelse} and {forelse} tags
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
03/23/2009
|
||||
- fixed {foreachelse} and {forelse} tags
|
||||
|
||||
03/22/2009
|
||||
- fixed possible sources for notice errors
|
||||
- rearrange SVN into distribution and development folders
|
||||
|
@@ -46,7 +46,7 @@ class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase {
|
||||
|
||||
$output = "<?php ";
|
||||
$output .= " \$_smarty_tpl->tpl_vars[$item] = new Smarty_Variable;\n";
|
||||
$output .= " \$_from = $from; if (\$_from !== false) { if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array');}\n";
|
||||
$output .= " \$_from = $from; if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array');}\n";
|
||||
$output .= " \$_smarty_tpl->tpl_vars[$item]->total=count(\$_from);\n";
|
||||
$output .= " \$_smarty_tpl->tpl_vars[$item]->iteration=0;\n";
|
||||
$output .= " \$_smarty_tpl->tpl_vars[$item]->index=-1;\n";
|
||||
|
@@ -28,8 +28,6 @@ class Smarty_Internal_Compile_ForClose extends Smarty_Internal_CompileBase {
|
||||
$_open_tag = $this->_close_tag(array('for', 'forarray', 'forelse'));
|
||||
if ($_open_tag == 'forelse')
|
||||
return "<?php } ?>";
|
||||
elseif ($_open_tag == 'forarray')
|
||||
return "<?php }}} ?>";
|
||||
else
|
||||
return "<?php }} ?>";
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase {
|
||||
if ($key != null) {
|
||||
$output .= " \$_smarty_tpl->tpl_vars[$key] = new Smarty_Variable;\n";
|
||||
}
|
||||
$output .= " \$_from = $from; if (\$_from !== false) { if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array');}\n";
|
||||
$output .= " \$_from = $from; if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array');}\n";
|
||||
if ($name != null) {
|
||||
$output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['total'] = count(\$_from);\n";
|
||||
$output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['iteration']=0;\n";
|
||||
|
@@ -28,7 +28,7 @@ class Smarty_Internal_Compile_ForeachClose extends Smarty_Internal_CompileBase {
|
||||
if ($_open_tag == 'foreachelse')
|
||||
return "<?php } ?>";
|
||||
else
|
||||
return "<?php }}} ?>";
|
||||
return "<?php }} ?>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -26,7 +26,7 @@ class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase {
|
||||
|
||||
$this->_close_tag('foreach');
|
||||
$this->_open_tag('foreachelse');
|
||||
return "<?php }}} else { ?>";
|
||||
return "<?php }} else { ?>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -25,12 +25,9 @@ class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase {
|
||||
// check and get attributes
|
||||
$_attr = $this->_get_attributes($args);
|
||||
|
||||
$_open_tag = $this->_close_tag(array('for', 'forarray'));
|
||||
$this->_close_tag(array('for', 'forarray'));
|
||||
$this->_open_tag('forelse');
|
||||
if ($_open_tag == 'forarray')
|
||||
return "<?php }}} else { ?>";
|
||||
else
|
||||
return "<?php }} else { ?>";
|
||||
return "<?php }} else { ?>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -373,7 +373,7 @@ class Undefined_Smarty_Variable {
|
||||
// return always false
|
||||
public function __get ($name)
|
||||
{
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1911,10 +1911,10 @@ static public $yy_action = array(
|
||||
#line 1916 "internal.templateparser.php"
|
||||
#line 292 "internal.templateparser.y"
|
||||
function yy_r61(){ if ($this->yystack[$this->yyidx + -1]->minor == '\'smarty\'') { $this->_retvalue = $this->compiler->compileTag(trim($this->yystack[$this->yyidx + -1]->minor,"'"),$this->yystack[$this->yyidx + 0]->minor);} else {
|
||||
$this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -1]->minor .')->value'.$this->yystack[$this->yyidx + 0]->minor; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + -1]->minor,"'"))->nocache;} }
|
||||
$this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -1]->minor .')->value'.$this->yystack[$this->yyidx + 0]->minor; $_var = $this->template->getVariable(trim($this->yystack[$this->yyidx + -1]->minor,"'")); if(!is_null($_var)) if ($_var->nocache) $this->nocache=true;} }
|
||||
#line 1920 "internal.templateparser.php"
|
||||
#line 295 "internal.templateparser.y"
|
||||
function yy_r62(){ $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->'.$this->yystack[$this->yyidx + 0]->minor; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor,"'"))->nocache; }
|
||||
function yy_r62(){ $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->'.$this->yystack[$this->yyidx + 0]->minor; $_var = $this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor,"'")); if(!is_null($_var)) if ($_var->nocache) $this->nocache=true; }
|
||||
#line 1923 "internal.templateparser.php"
|
||||
#line 307 "internal.templateparser.y"
|
||||
function yy_r65(){return; }
|
||||
@@ -1941,7 +1941,7 @@ static public $yy_action = array(
|
||||
function yy_r73(){$this->_retvalue = '('.$this->yystack[$this->yyidx + -1]->minor.')'; }
|
||||
#line 1947 "internal.templateparser.php"
|
||||
#line 333 "internal.templateparser.y"
|
||||
function yy_r74(){ $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->value'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; $this->nocache=$this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor,"'"))->nocache; }
|
||||
function yy_r74(){ $this->_retvalue = '$_smarty_tpl->getVariable('. $this->yystack[$this->yyidx + -2]->minor .')->value'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; $_var = $this->template->getVariable(trim($this->yystack[$this->yyidx + -2]->minor,"'")); if(!is_null($_var)) if ($_var->nocache) $this->nocache=true; }
|
||||
#line 1950 "internal.templateparser.php"
|
||||
#line 335 "internal.templateparser.y"
|
||||
function yy_r75(){$this->_retvalue = $this->yystack[$this->yyidx + 0]->minor; }
|
||||
@@ -1983,7 +1983,7 @@ static public $yy_action = array(
|
||||
function yy_r86(){ $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
#line 1989 "internal.templateparser.php"
|
||||
#line 384 "internal.templateparser.y"
|
||||
function yy_r88(){$this->_retvalue = ',\''.$this->yystack[$this->yyidx + 0]->minor.'\''; }
|
||||
function yy_r88(){$this->_retvalue = ','.$this->yystack[$this->yyidx + 0]->minor.''; }
|
||||
#line 1992 "internal.templateparser.php"
|
||||
#line 385 "internal.templateparser.y"
|
||||
function yy_r89(){$this->_retvalue = ','.$this->yystack[$this->yyidx + 0]->minor; }
|
||||
|
Reference in New Issue
Block a user