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