/** * Renders a template * * @param bool $fetch - Just return the html instead of rendering directly on screen * @param bool $changeTitle - If it must change the title to the module's title * @return string */ public function render($fetch = true, $changeTitle = true) { try { $method = $fetch ? 'fetch' : 'display'; if ($changeTitle && count($this->pageTitle) > 0) { $setTitle = Html::ReplaceHtml($this->pageTitle['title'], '#page_title') . Html::ReplaceHtml($this->pageTitle['description'] . APPTITLE, 'title'); if (Core::isAjax()) { echo $setTitle; } } $hasJs = count($this->jsFiles) > 0 || count($this->templateJsFiles) > 0; return $this->smarty->{$method}($this->template) . ($hasJs ? $this->injectJSFiles() : ''); } catch (Exception $e) { echo Html::ReplaceHtml(ExceptionHandler::throwException(array('message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine())), 'html'); exit; } }