本文整理汇总了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);
}
示例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');
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例6: isPageCached
public function isPageCached()
{
if ($this->cacheId !== null and parent::isCached($this->mainTemplate, $this->cacheId)) {
return true;
}
return false;
}
示例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);
}
示例8: isCached
public function isCached($template, $cache_id = null)
{
$this->setCompileId();
return $this->smarty->isCached($template, $cache_id);
}
示例9: isCached
public function isCached($template, $cache_id = null)
{
return $this->smarty->isCached($template, $cache_id);
}
示例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);
}
示例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);
示例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');
}