21 parent::__construct(
array(),
array(
'with_loop' =>
false,
'ifexpr' =>
false,
'else' =>
false),
$lineno,
$tag);
27 $compiler->
write(
"\$context['_iterated'] = true;\n");
32 ->
write(
"++\$context['loop']['index0'];\n")
33 ->write(
"++\$context['loop']['index'];\n")
34 ->write(
"\$context['loop']['first'] = false;\n")
39 ->
write(
"if (isset(\$context['loop']['length'])) {\n")
41 ->write(
"--\$context['loop']['revindex0'];\n")
42 ->write(
"--\$context['loop']['revindex'];\n")
43 ->write(
"\$context['loop']['last'] = 0 === \$context['loop']['revindex0'];\n")
52 class_alias(
'Twig_Node_ForLoop',
'Twig\Node\ForLoopNode',
false);
compile(Twig_Compiler $compiler)
Compiles the node to PHP.
Internal node used by the for node.
Represents a node in the AST.
__construct($lineno, $tag=null)
Create styles array
The data for the language used.
write()
Writes a string to the compiled code by adding indentation.