mirror of
https://github.com/smarty-php/smarty.git
synced 2026-05-03 19:30:49 +02:00
- allow spaces between typecast and value in template syntax
- bugfix get correct count of traversables in {foreach} tag
This commit is contained in:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user