public function process(Pagemill_Tag $tag, Pagemill_Data $data, Pagemill_Stream $stream) { $result = $data->evaluate($this->_expression); if ($result) { $tmp = new Pagemill_Tag($tag->name(), $tag->attributes(), $tag->parent()); $tmp->appendText($result); if ($this->_replace) { $tmp->processInner($data, $stream); } else { $tmp->process($data, $stream); } $tmp->detach(); return false; } else { if ($this->_replace) { $tag->processInner($data, $stream); return false; } } return true; }
public function process(Pagemill_Tag $tag, Pagemill_Data $data, Pagemill_Stream $stream) { $attributes = array(); $name = $this->_loopAttributes; $parts = explode(' ', $name, 2); $attributes['name'] = $parts[0]; if (isset($parts[1])) { $attributes['as'] = $parts[1]; } $loop = new Pagemill_Tag_Loop('loop', $attributes, null, $tag->doctype()); $temptag = new Pagemill_Tag($tag->name(), $tag->attributes(), null, $tag->doctype()); foreach ($tag->children() as $child) { $temptag->appendChild($child); } $loop->appendChild($temptag); $loop->process($data, $stream); foreach ($temptag->children() as $child) { $tag->appendChild($child); } return false; }