- allow spaces between typecast and value in template syntax

- bugfix get correct count of traversables in {foreach} tag
This commit is contained in:
Uwe.Tews
2010-06-22 18:09:12 +00:00
parent f7fd63e890
commit 95869f258e
3 changed files with 6 additions and 2 deletions
@@ -80,7 +80,7 @@ class Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase {
}
$output .= " \$_from = $from; if (!is_array(\$_from) && !is_object(\$_from)) { settype(\$_from, 'array');}\n";
if ($usesPropTotal) {
$output .= " \$_smarty_tpl->tpl_vars[$item]->total=count(\$_from);\n";
$output .= " \$_smarty_tpl->tpl_vars[$item]->total=(\$_from instanceof Traversable)?iterator_count(\$_from):count(\$_from);\n";
}
if ($usesPropIteration) {
$output .= " \$_smarty_tpl->tpl_vars[$item]->iteration=0;\n";