Example #1
0
 /**
  * This function is the final step to render a website, it passes the final arguments to the template, including
  * all error messages, gathered so far. And finally flushes the website content.
  *
  * @api
  */
 public function display()
 {
     // minify js
     $jsFile = template\JavascriptTemplate::combine($this->jsFiles);
     if ($jsFile !== false) {
         $this->assign('customjsfile', [$jsFile]);
     } else {
         $this->assign('customjsfile', []);
     }
     // minify css
     $cssFile = template\CssTemplate::combine($this->cssFiles);
     if ($cssFile !== false) {
         $this->assign('customcssfile', [$cssFile]);
     } else {
         $this->assign('customcssfile', []);
     }
     // this code is not safe for use in different tabs
     foreach (Session::getErrorMsg() as $error) {
         $this->append('errors', ($error['field'] ? '"' . $error['field'] . '" - ' : '') . $error['content']);
     }
     foreach (Session::getSuccessMsg() as $success) {
         $this->append('success', $success);
     }
     // we need a relative dir from smarty templates
     template\HtmlTemplate::getInstance()->display('layout.tpl');
     // after we've displayed them, we may reset them
     Session::resetErrorMsg();
     Session::resetSuccessMsg();
 }