Exemplo n.º 1
0
 /**
  * Build the pagination
  * @since Version 3.10.0
  * @return string
  */
 private function buildPagination()
 {
     $this->validate();
     $this->buildStartLinks()->buildEndLinks()->buildCurrentPage()->addDividers()->addNavigation();
     $tpl = $this->Smarty->ResolveTemplate($this->params['template']);
     $caching = false;
     if (isset($this->Smarty->cache) && $this->Smarty->cache == true) {
         $caching = true;
         $this->Smarty->cache = false;
         $this->Smarty->clearCache($tpl);
     }
     $this->Smarty->Assign("pagination", $this->getParam("links"));
     $html = $this->Smarty->Fetch($tpl);
     if ($caching) {
         $this->Smarty->cache = true;
     }
     return $html;
 }
Exemplo n.º 2
0
 /**
  * Get our smarty template engine
  * @since Version 3.9.1
  * @return \Railpage\Template
  */
 public static function getSmarty()
 {
     $Registry = Registry::getInstance();
     $Config = self::getConfig();
     try {
         $Smarty = $Registry->get("smarty");
     } catch (Exception $e) {
         $Smarty = new Template();
         /**
          * Send the RP config to Smarty
          */
         $Smarty->setRailpageConfig($Config);
         /**
          * Smarty options and configuration
          */
         $Smarty->debugging = false;
         $Smarty->caching = false;
         $Smarty->cache_lifetime = 120;
         $Smarty->site_root = RP_SITE_ROOT;
         $Smarty->use_sub_dirs = true;
         $Smarty->assign("rp_host", RP_HOST);
         $Smarty->assign("rand", rand());
         $Smarty->assign("rp_version", defined("RP_VERSION") ? RP_VERSION : "0.0.0");
         $Smarty->assign("rp_web_root", defined("RP_WEB_ROOT") ? RP_WEB_ROOT : __DIR__);
         $Smarty->assign("site_name", $Config->SiteName);
         $Smarty->assign("rp_production", defined("RP_ISPRODUCTION") ? "RP_ISPRODUCTION" : define("RP_ISPRODUCTION", true) ? true : false);
         $Smarty->assign("ad_header", $Config->AdHeader);
         $Smarty->assign("rp_map_styles", json_encode($Config->Google->Maps->Styles));
         $Smarty->assign("rp_map_icons", json_encode($Config->Google->Maps->Icons));
         $Smarty->subtheme = "smooth";
         $Smarty->Assign("rp_ui_show_banner_head", true);
         /**
          * Set the template compile directory
          */
         $Smarty->setCompileDir(dirname(RP_SITE_ROOT) . DS . "smarty" . DS . "compile");
         $Registry->set("smarty", $Smarty);
     }
     return $Smarty;
 }