Ejemplo n.º 1
0
 /**
  * Render view object
  *
  * @param WebPage $webpage
  * @return string result of rendering process
  */
 public static function render($webpage)
 {
     $tplEngine = $webpage->templateEngine;
     $tplAttributes = ViewRenderer::buildTemplateAttributes($webpage);
     ob_start();
     if ($tplEngine == "Smarty" || $tplEngine == null) {
         ViewRenderer::renderSmarty($webpage, $tplAttributes);
     } else {
         ViewRenderer::renderPHP($webpage, $tplAttributes);
     }
     $html = ob_get_contents();
     ob_end_clean();
     if (defined("OPENBIZ_PAGE_MINIFY") && OPENBIZ_PAGE_MINIFY == 1) {
         $html = self::MinifyOutput($html);
     }
     return $html;
 }
Ejemplo n.º 2
0
 /**
  * Render this view. This function is called by Render() or ReRender()
  *
  * @return mixed either print html content or return html content if called by Render(), or void if called by ReRender()
  */
 protected function _render()
 {
     if ($this->cacheLifeTime > 0) {
         $pageUrl = $this->curPageURL();
         $cache_id = md5($pageUrl);
         //try to process cache service.
         $cacheSvc = Openbizx::getService(CACHE_SERVICE, 1);
         $cacheSvc->init($this->objectName, $this->cacheLifeTime);
         $this->consoleOutput = false;
         $output = ViewRenderer::render($this);
         Openbizx::$app->getLog()->log(LOG_DEBUG, "VIEW", "Set cache. url = " . $pageUrl);
         $cacheSvc->save($output, $cache_id);
         return $output;
     } else {
         $this->setClientScripts();
         return ViewRenderer::render($this);
     }
     return;
 }