protected function renderTemplate($templateName) { // include tpl file. $tpl = $this->kernel->findFileOnPath($templateName, $this->kernel->getTemplatesPath()); if (!$tpl) { throw new Exception("Template `{$templateName}` not found"); } $HD_PUBLIC = $this->kernel->getParam('public', ''); ob_start(); include $tpl; return ob_get_clean(); }
public function output($path) { $assetPath = ltrim($path, '/'); $pathParts = explode('/', $assetPath); $type = array_shift($pathParts); $assetPath = implode(DIRECTORY_SEPARATOR, $pathParts); $filename = ''; switch ($type) { case 'templates': $filename = $this->kernel->findFileOnPath($assetPath, $this->kernel->getTemplatesPath()); break; case 'widgets': $filename = $this->kernel->findFileOnPath($assetPath, $this->kernel->getWidgetsPath()); break; default: //$this->kernel->log("Unknown asset type '{$type}'"); } if ($filename) { return $this->proxy($filename); } $this->kernel->log("404"); }