/** * (non-PHPdoc) * * @see RenderInterface::render() */ public function render(Request $request, Response $response, ResponseContent $content) { $path = (string) Configuration::getInstance()->templates->path; $template = $request->getBasePath(); if (!$template) { $template = "index"; } $response->setContent($this->getIncludeContents("{$path}/{$template}.phtml", $content)); return $response; }
/** * return the connection as laid out in configuration.xml * * @param string $role * @return DataAccessInterface */ public function getConnection($role = 'master') { $root = basename(realpath(__DIR__ . "/../../../")); $database = Configuration::getInstance()->xpath("environment[@rootFolderName='{$root}']/database[@role='{$role}']"); $class = (string) $database[0]->attributes()->class; $host = (string) $database[0]->attributes()->host; $name = (string) $database[0]->attributes()->name; $user = (string) $database[0]->attributes()->user; $pass = (string) $database[0]->attributes()->pass; return new $class($host, $user, $pass, $name); }
/** * (non-PHPdoc) * * @see RenderInterface::render() */ public function render(Request $request, Response $response, ResponseContent $content) { $renderer = new XMLRenderer(); $xml = $renderer->to_domdocument($content); $xsl = new DOMDocument(); $path = Configuration::getInstance()->templates; $template = $request->getBasePath(); $xsl->load("{$path}/{$template}.xsl"); $proc = new XSLTProcessor(); $proc->importStyleSheet($xsl); $response->setContent($proc->transformToXML($xml)); return $response; }