protected function walkSection(SectionNode $section) { $exprSym = $this->gensym(); $ret = "{$exprSym} = " . $this->walk($section->getExpression()) . ";"; $ret .= "\$smarty->section->{$section->getName()} = (object) array('index' => -1, 'iteration' => 0, 'first' => null, 'last' => null, 'total' => (int) {$exprSym});"; $ret .= "while (\$smarty->section->{$section->getName()}->iteration < \$smarty->section->{$section->getName()}->total) {"; $ret .= "++\$smarty->section->{$section->getName()}->index;"; $ret .= "++\$smarty->section->{$section->getName()}->iteration;"; $ret .= "\$smarty->section->{$section->getName()}->first = \$smarty->section->{$section->getName()}->index == 0;"; $ret .= "\$smarty->section->{$section->getName()}->last = \$smarty->section->{$section->getName()}->iteration == \$smarty->section->{$section->getName()}->total;"; $ret .= implode("", $this->walkEach($section->getBody())); $ret .= "}"; return $ret; }
protected function walkSection(SectionNode $section) { $this->walkEachDisallow($section->getBody(), "section"); }
protected function walkSection(SectionNode $section) { return new SectionNode($section->getName(), $section->getExpression(), $this->walkEach($section->getBody())); }
protected function walkSection(SectionNode $section) { $variableNames = array(); foreach ($section->getBody() as $statement) { foreach ($this->walk($statement) as $name => $_) { $variableNames[$name] = true; } } return $variableNames; }