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__'); }