/**
  * Add a path for templates.
  *
  * @param string $path
  * @param string $namespace
  */
 public function addPath($path, $namespace = null)
 {
     $this->paths[$namespace] = $path;
     $viewRegistry = $this->renderer->getViewRegistry();
     $viewRegistry->appendPath($path);
     $layoutRegistry = $this->renderer->getLayoutRegistry();
     $layoutRegistry->appendPath($path);
 }
 protected function setTemplate(View $view, RootConfig $config)
 {
     $template = $config->getTemplate();
     if (!$template) {
         $template = dirname(dirname(dirname(__DIR__))) . '/templates/main.php';
     }
     if (!file_exists($template) && !is_readable($template)) {
         throw new Exception("Cannot find template '{$template}'.");
     }
     $registry = $view->getViewRegistry();
     $registry->set('__BOOKDOWN__', $template);
     $view->setView('__BOOKDOWN__');
 }
Exemplo n.º 3
0
 /**
  * Has
  *
  * @param string $name name of script
  *
  * @return bool
  *
  * @access protected
  */
 protected function has($name)
 {
     return $this->view->getViewRegistry()->has($name);
 }