Ejemplo n.º 1
0
 public function render_layout()
 {
     if (!$this->use_layout) {
         return false;
     }
     $this->use_format = "html";
     $layout = new WaxTemplate($this);
     $layout->add_path(VIEW_DIR . "layouts/" . $this->use_layout);
     ob_end_clean();
     return $layout->parse($this->use_format);
 }
Ejemplo n.º 2
0
 /**
  *  Returns a layout as a string.
  *	@return string
  */
 protected function render_layout()
 {
     if (!$this->use_layout) {
         return false;
     }
     if (Config::get('page_cache') && !substr_count($this->controller, "admin")) {
         $sess = $_SESSION[Session::get_hash()];
         unset($sess['referrer']);
         $fname = $_SERVER['HTTP_HOST'] . md5($_SERVER['REQUEST_URI'] . serialize($_GET) . serialize($sess)) . '.layout';
         $cache = new WaxCache($fname);
         if (count($_POST)) {
             $cache->expire();
         } else {
             if ($cache->valid()) {
                 return $cache->get();
             }
         }
     }
     $layout = new WaxTemplate($this);
     $layout->add_path(VIEW_DIR . "layouts/" . $this->use_layout);
     $layout->add_path(PLUGIN_DIR . $this->use_plugin . "/view/layouts/" . $this->use_layout);
     $layout->add_path(PLUGIN_DIR . $this->share_plugin . "/view/layouts/" . $this->use_layout);
     ob_end_clean();
     $layout = $layout->parse();
     if (Config::get('page_cache') && !substr_count($this->controller, "admin")) {
         $cache->set($layout);
     }
     return $layout;
 }