/** * Magic cast to string * * @return string */ public function __toString() { if (!$this->template) { return ''; } // $view for use in closure $view = new View(); $path = Application::getInstance()->getPath(); // setup additional helper path $view->addHelperPath($path . '/layouts/helpers'); // setup additional partial path $view->addPartialPath($path . '/layouts/partial'); // setup default path $view->setPath($path . '/modules/' . $this->module . '/views'); // setup template $view->setTemplate($this->template); // setup data $view->setFromArray($this->getData()->toArray()); return $view->render(); }
public function getCompiledTemplate() { $view = new View(); $view->setPath($this->getAbsolutePath()); $view->setTemplate($this->getTemplate()->getTemplatePath()); $view->setFromArray($this->getTemplate()->getTemplateData()); return $view->render(); }