public function decorate(RendererAwareInterface $owner, &$content, $data) { $template = empty($data['template']) ? $this->template : $data['template']; $view = new MiniView($this, sprintf('%s/%s', $owner->getRootPath(), $owner->getLayoutPath())); $view->setViewsPath(''); $data['content'] = $content; $content = $view->render($template, ['data' => (object) $data, 'view' => $view], true); }
public function render($view = 'index', $data = []) { $message = $this->_code; if (!empty($this->_message)) { $message .= ": {$this->_message}"; } header("HTTP/1.0 {$this->_code}"); $path = sprintf('%s/%s/_%s.php', $this->getOwner()->getRootPath(), $this->getOwner()->getContentPath(), $this->_code); if (file_exists($path)) { $mv = new MiniView($this, $this->getOwner()->getRootPath()); $mv->setViewsPath($this->getOwner()->getContentPath()); return $mv->render(sprintf('_%s', $this->_code), ['code' => $this->_code, 'message' => $this->_message], true); } return <<<HTML \t\t<h1>{$message}</h1> HTML; }
public function render($view = 'index', $data = []) { $mv = new MiniView($this, $this->getOwner()->getRootPath()); $mv->setViewsPath($this->getOwner()->getContentPath()); return $mv->render($view, $data, true); }