/** * It renders the template file. * * This method is usefull when you don`t want to use the default template_root * Special helper file is included. * Magic __layout.phtml is loaded if exists. * * @param string, template_file location of the template file, default NULL * @param Response::SC_*, status, [optional] status code, default is 200 OK * @throws FileNotFoundException if the template file don`t exist on the specified location. * @return void */ protected function render_file($template_file, $status = NULL) { if (!is_file($template_file)) { throw new FileNotFoundException('Cannot render unexistent template file:' . $template_file); } // load helper $this->injector->inject('helper', $this->params['controller']); // register flash $this->register_flash(); if ($this->use_layout) { $layout = $this->use_layout === TRUE ? $this->params['controller'] : $this->use_layout; $layout_file = $this->injector->getPath('layouts') . $layout . '.phtml'; $this->logger->debug('[Medick] >> Using layout: ' . str_replace($this->config->getApplicationPath(), '${' . $this->config->getApplicationName() . '}', $layout_file)); if (!is_file($layout_file)) { return $this->render_without_layout($template_file, $status); } else { $this->template->content_for_layout = $this->template->render_file($template_file); return $this->render_text($this->template->render_file($layout_file), $status); } } else { return $this->render_without_layout($template_file, $status); } }