Example #1
0
 protected function processStack($stack)
 {
     $res = '';
     while (count($stack['children'])) {
         $current = array_shift($stack['children']);
         switch ($current['type']) {
             case 'string':
                 $res .= $current['body'];
                 break;
             case '@':
                 $res .= $this->doParseVar($current['cond']);
                 break;
             case 'if':
                 $res .= $this->doParseIf($current['cond'], $current, true);
                 break;
             case 'ifnot':
                 $res .= $this->doParseIf($current['cond'], $current, false);
                 break;
             case 'loop':
                 $res .= $this->doParseLoop($current['cond'], $current);
                 break;
             case 'for':
                 $res .= $this->doParseFor($current['cond'], $current);
                 break;
             case 'function':
                 $res .= $this->template->executeTemplateFunction($current['function_name'], $current['cond']);
                 break;
         }
     }
     return $res;
 }