当前位置: 首页>>代码示例>>PHP>>正文


PHP Smarty::isCached方法代码示例

本文整理汇总了PHP中Smarty::isCached方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty::isCached方法的具体用法?PHP Smarty::isCached怎么用?PHP Smarty::isCached使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Smarty的用法示例。


在下文中一共展示了Smarty::isCached方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isCached

 public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)
 {
     if (is_null($template)) {
         $template = CONTROLLER_NAME . '/' . ACTION_NAME . C('view_suffix');
     } elseif (strstr($template, '.')) {
         //直接使用模板路径
     } elseif (strstr($template, ':')) {
         $template = str_replace(':', '/', $template);
         $template = $template . C('view_suffix');
     } else {
         $template = CONTROLLER_NAME . '/' . $template . C('view_suffix');
     }
     return parent::isCached($template, $cache_id, $compile_id, $parent);
 }
开发者ID:actcms,项目名称:frogphp,代码行数:14,代码来源:SmartyVendor.class.php

示例2: Render

 /**
  * Renders the output
  */
 public function Render()
 {
     if ($this->config->GetValue('cache') == true && $this->config->GetValue('cacheexpire') === true) {
         $this->CacheExpire();
     }
     $log = GitPHP_DebugLog::GetInstance();
     if (!$this->tpl->isCached($this->GetTemplate(), $this->GetFullCacheKey())) {
         $this->tpl->clearAllAssign();
         $log->TimerStart();
         $this->LoadCommonData();
         $log->TimerStop('Common data');
         $log->TimerStart();
         $this->LoadData();
         $log->TimerStop('Data');
     }
     if (!$this->preserveWhitespace) {
         //$this->tpl->loadFilter('output', 'trimwhitespace');
     }
     $log->TimerStart();
     $this->tpl->display($this->GetTemplate(), $this->GetFullCacheKey());
     $log->TimerStop('Render');
     $this->tpl->clearAllAssign();
     if ($this->projectList) {
         $log->Log('MemoryCache', 'Count: ' . $this->projectList->GetMemoryCache()->GetCount());
     }
     if ($log->GetEnabled()) {
         $this->tpl->assign('debuglog', $log);
         $this->tpl->display('debug.tpl');
     }
 }
开发者ID:hmcclungiii,项目名称:gitphp,代码行数:33,代码来源:ControllerBase.class.php

示例3: isCached

 /**
  * @param null $template
  * @param null $cache_id
  * @param null $compile_id
  * @param null $parent
  * @return bool
  */
 public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)
 {
     try {
         return $this->smarty->isCached($template, $cache_id, $compile_id, $parent);
     } catch (\Exception $e) {
         return false;
     }
 }
开发者ID:skullyframework,项目名称:skully,代码行数:15,代码来源:SmartyAdapter.php

示例4: isCached

 /**
  * Проверка существования кэштрованного файла для данной страницы
  * @param null $template
  * @param null $cache_id
  * @param null $compile_id
  * @param null $parent
  * @return bool
  */
 public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)
 {
     if (isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI'] != '') {
         // Проверка существования идентификатора кэша
         $query = 'CALL check_cach_id(:link)';
         $params = array(':link' => $_SERVER['REQUEST_URI']);
         $check = PdoWrap::selectRow($query, $params);
         if (isset($check['id']) && (int) $check['id'] > 0) {
             $this->setCurrentTemplate($check['template']);
             $this->setCurrentCachId($check['id']);
             return parent::isCached($check['template'], $check['id']);
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
开发者ID:klimjr,项目名称:cms,代码行数:26,代码来源:class.SmartyWrap.php

示例5: show_News

 public function show_News()
 {
     header("Content-Type: application/rss+xml; charset=UTF-8");
     $tpl = new Smarty();
     $tpl->cache_lifetime = 3600 * 24;
     $tpl->setCaching(Smarty::CACHING_LIFETIME_CURRENT);
     $cacheID = 'rssFeed';
     if (!$tpl->isCached('rss.xml', $cacheID)) {
         $items = array();
         $dbItems = R::find('homepage_posts', ' 1=1 ORDER BY id DESC LIMIT 15');
         foreach ($dbItems as $item) {
             $author = R::relatedOne($item, 'user');
             $items[] = array('title' => $item->title, 'link' => $item->link == '' ? APP_WEBSITE . APP_DIR : $item->link, 'description' => $item->content, 'author' => $author->username, 'date' => date("D, d M Y H:i:s O", $item->time));
         }
         $tpl->assign('items', $items);
         $tpl->assign('gentime', date("D, d M Y H:i:s O"));
         $tpl->assign('link', APP_WEBSITE . APP_DIR);
     }
     $tpl->display('rss.xml', $cacheID);
 }
开发者ID:agrafix,项目名称:managerslife,代码行数:20,代码来源:Site_Rss.class.php

示例6: isPageCached

 public function isPageCached()
 {
     if ($this->cacheId !== null and parent::isCached($this->mainTemplate, $this->cacheId)) {
         return true;
     }
     return false;
 }
开发者ID:Welvin,项目名称:stingle,代码行数:7,代码来源:SmartyWrapper.class.php

示例7: isCached

 public function isCached($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL)
 {
     if ($template) {
         $tpl = $template;
     } else {
         $tpl = system::param("page");
     }
     if ($cache_id) {
         $cacheID = $cache_id;
     } else {
         $cacheID = $this->cacheIdShow;
     }
     $checkStr = "{$tpl}.tpl";
     if (system::param("templateBase")) {
         $checkStr = "extends:" . system::param("templateBase") . "|{$checkStr}";
     }
     return parent::isCached($checkStr, $cacheID);
 }
开发者ID:ygres,项目名称:sblog,代码行数:18,代码来源:class.tpl.php

示例8: isCached

 public function isCached($template, $cache_id = null)
 {
     $this->setCompileId();
     return $this->smarty->isCached($template, $cache_id);
 }
开发者ID:Lazary,项目名称:webasyst,代码行数:5,代码来源:waSmarty3View.class.php

示例9: isCached

 public function isCached($template, $cache_id = null)
 {
     return $this->smarty->isCached($template, $cache_id);
 }
开发者ID:navi8602,项目名称:wa-shop-ppg,代码行数:4,代码来源:waSmarty3View.class.php

示例10: isCached

 public function isCached($template, $cache_id = null, $compile_id = null, $parent = null)
 {
     $template = $this->get_template_real_path($template);
     return parent::isCached($template, $cache_id, $compile_id, $parent);
 }
开发者ID:uwitec,项目名称:mgoa,代码行数:5,代码来源:smarty.php

示例11: Smarty

<?php

require_once 'app/core/init.php';
require_once 'main.php';
$smarty = new Smarty();
$smarty->debugging = Config::get('debug/smartyDebug');
$smarty->caching = Config::get('smarty/caching');
$smarty->cache_lifetime = Config::get('smarty/cache_lifetime');
$cache_id = md5(json_encode($_GET) . json_encode($_POST) . Notifications::getAsJson());
if (!$smarty->isCached('templates/errors/404.tpl', $cache_id)) {
    $smarty = pageAddMain($smarty);
}
$smarty = pageAddMessages($smarty);
$smarty->loadFilter("output", "trimwhitespace");
$smarty->display('templates/errors/404.tpl', $cache_id);
开发者ID:Wicloz,项目名称:UniversityWebsite,代码行数:15,代码来源:404.php

示例12: Smarty

<?php

require_once 'app/core/init.php';
require_once 'main.php';
if (isset($_GET['page']) && !empty($_GET['page'])) {
    $smarty = new Smarty();
    $smarty->debugging = Config::get('debug/smartyDebug');
    $smarty->caching = Config::get('smarty/caching');
    $smarty->cache_lifetime = Config::get('smarty/cache_lifetime');
    $cache_id = md5(json_encode($_GET) . json_encode($_POST) . Notifications::getAsJson());
    $pageFile = 'app/pages/' . $_GET['page'] . '.php';
    $templateFile = 'templates/pages/' . $_GET['page'] . '.tpl';
    if (file_exists($pageFile) && file_exists($templateFile)) {
        require $pageFile;
        if (!$allowCaching) {
            $cache_id = md5($cache_id . Hash::hashUnique());
        }
        if (!$smarty->isCached($templateFile, $cache_id)) {
            $smarty = createPage($smarty);
            $smarty = pageAddMain($smarty);
        }
        $smarty = pageAddMessages($smarty);
        $smarty->loadFilter("output", "trimwhitespace");
        $smarty->display($templateFile, $cache_id);
    } else {
        Redirect::error(404);
    }
} else {
    Redirect::to('?page=home');
}
开发者ID:Wicloz,项目名称:UniversityWebsite,代码行数:30,代码来源:index.php


注:本文中的Smarty::isCached方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。