Ejemplo n.º 1
0
 protected function walkCapture(CaptureNode $capture)
 {
     $ret = "ob_start();";
     foreach ($capture->getBody() as $statement) {
         $ret .= $this->walk($statement);
     }
     $resultSym = $this->gensym();
     $ret .= "{$resultSym} = ob_get_clean();";
     if ($capture->getName() !== null) {
         $ret .= "\$smarty->capture->{$capture->getName()} = {$resultSym};";
     }
     if ($capture->getAssign() !== null) {
         $ret .= "\${$capture->getAssign()} = {$resultSym};";
     }
     if ($capture->getAppend() !== null) {
         $ret .= "if (!isset(\${$capture->getAppend()})) { \${$capture->getAppend()} = array(); }";
         $ret .= "\${$capture->getAppend()}[] = {$resultSym};";
     }
     return $ret;
 }
Ejemplo n.º 2
0
 protected function walkCapture(CaptureNode $capture)
 {
     return new CaptureNode($capture->getName(), $capture->getAssign(), $capture->getAppend(), $this->walkEach($capture->getBody()));
 }