public function renderAsHtml(TemplateEngine $templateEngine)
 {
     $tpl = null;
     if (isset($this->_template)) {
         $tpl = $this->_templatePath . $this->_template;
     } else {
         $tpl = $this->_templatePath . strtolower($this->_routing->getController()) . '/' . strtolower($this->_routing->getAction()) . '.tpl';
     }
     header('Content-Type: text/html');
     $templateEngine->setTemplatePath($this->_templatePath);
     return $templateEngine->render($this->_body, $tpl);
 }
Example #2
0
 protected function buildRouting()
 {
     // get application module
     $module = $this->getApplicationModule();
     // build a new routing
     $this->_routing = new HttpRequestRouting($module);
     if (empty($this->_uriParams)) {
         return;
     }
     $this->_routing->setController($this->_uriParams[0]);
     unset($this->_uriParams[0]);
     if (array_key_exists(1, $this->_uriParams)) {
         $this->_routing->setAction($this->_uriParams[1]);
         unset($this->_uriParams[1]);
     }
     array_values($this->_uriParams);
 }