/** * Shortcut for rendering a template * @param string $templateName: the name of the template * @param array $params: the template parameters in key => value structure * @param string $renderAs: user renders a full page, blank only your template * admin an entry in the admin settings * @param array $headers: set additional headers * @return a TemplateResponse */ protected function render($templateName, $params = array(), $renderAs = 'user', $headers = array()) { $response = new TemplateResponse($this->appName, $templateName, $renderAs); $response->setParams($params); $response->renderAs($renderAs); foreach ($headers as $header) { $response->addHeader($header); } return $response; }