/**
  * Render view object
  *
  * @param WebPage $webpage
  * @return string result of rendering process
  */
 public static function render($webpage)
 {
     $tplEngine = $webpage->templateEngine;
     $tplAttributes = ViewRenderer::buildTemplateAttributes($webpage);
     if (defined("OPENBIZ_PAGE_MINIFY") && OPENBIZ_PAGE_MINIFY == 1) {
         ob_start();
     }
     if ($tplEngine == "Smarty" || $tplEngine == null) {
         ViewRenderer::renderSmarty($webpage, $tplAttributes);
     } else {
         ViewRenderer::renderPHP($webpage, $tplAttributes);
     }
     if (defined("OPENBIZ_PAGE_MINIFY") && OPENBIZ_PAGE_MINIFY == 1) {
         $html = ob_get_contents();
         ob_end_clean();
         $html = self::MinifyOutput($html);
         echo $html;
     }
     return $html;
 }
Exemple #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()
 {
     $this->setClientScripts();
     if ($this->cacheLifeTime > 0) {
         $pageUrl = $this->curPageURL();
         $cache_id = md5($pageUrl);
         //try to process cache service.
         $cacheSvc = Openbiz::getService(CACHE_SERVICE, 1);
         $cacheSvc->init($this->objectName, $this->cacheLifeTime);
         //if ($cacheSvc->test($cache_id)) {
         //    Openbiz::$app->getLog()->log(LOG_DEBUG, "VIEW", "Cache Hit. url = " . $pageUrl);
         //    $output = $cacheSvc->load($cache_id);
         //} else {
         //include_once(OPENBIZ_BIN."/Easy/ViewRenderer.php");
         $this->consoleOutput = false;
         $output = ViewRenderer::render($this);
         Openbiz::$app->getLog()->log(LOG_DEBUG, "VIEW", "Set cache. url = " . $pageUrl);
         $cacheSvc->save($output, $cache_id);
         //}
         print $output;
     } else {
         ViewRenderer::render($this);
     }
     return;
     /*
      $this->setClientScripts();
      //include_once(OPENBIZ_BIN."/Easy/ViewRenderer.php");
      return ViewRenderer::render($this);
     */
 }