本文整理汇总了PHP中XoopsTpl::xoops_setCacheTime方法的典型用法代码示例。如果您正苦于以下问题:PHP XoopsTpl::xoops_setCacheTime方法的具体用法?PHP XoopsTpl::xoops_setCacheTime怎么用?PHP XoopsTpl::xoops_setCacheTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XoopsTpl
的用法示例。
在下文中一共展示了XoopsTpl::xoops_setCacheTime方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: XoopsTpl
* $Id: backend.php,v 1.2 2005/08/02 03:47:51 mauriciodelima Exp $
* Module: SmartSection
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
include_once "header.php";
global $smartsection_item_handler, $smartsection_category_handler, $xoopsUser, $xoopsConfig, $xoopsModuleConfig, $xoopsModule;
include_once XOOPS_ROOT_PATH . '/class/template.php';
include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php';
if (function_exists('mb_http_output')) {
mb_http_output('pass');
}
header('Content-Type:text/xml; charset=utf-8');
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(3600);
if (!$tpl->is_cached('db:system_rss.html')) {
$sarray = $smartsection_item_handler->getAllPublished(10);
if (is_array($sarray)) {
$tpl->assign('channel_title', xoops_utf8_encode(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
$tpl->assign('channel_link', XOOPS_URL . '/');
$tpl->assign('channel_desc', xoops_utf8_encode(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
$tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
$tpl->assign('channel_webmaster', $xoopsConfig['adminmail']);
$tpl->assign('channel_editor', $xoopsConfig['adminmail']);
$tpl->assign('channel_category', 'News');
$tpl->assign('channel_generator', 'SmartSection');
$tpl->assign('channel_language', _LANGCODE);
$tpl->assign('image_url', XOOPS_URL . '/images/logo.gif');
$dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.gif');
if (empty($dimention[0])) {
示例2: intval
$topicid = intval($_GET['topicid']);
}
if (!$topicid) {
exit;
}
$myts =& MyTextSanitizer::getInstance();
if (function_exists('mb_http_output')) {
mb_http_output('pass');
}
$restricted = getmoduleoption('restrictindex');
$newsnumber = getmoduleoption('storyhome');
header('Content-Type:text/xml; charset=utf-8');
$story = new NewsStory();
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(0);
if (!$tpl->is_cached('db:system_rss.html')) {
$sarray = $story->getAllPublished($newsnumber, 0, $restricted, $topicid);
if (is_array($sarray) && count($sarray) > 0) {
$tpl->assign('channel_title', xoops_utf8_encode(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
$tpl->assign('channel_link', XOOPS_URL . '/');
$tpl->assign('channel_desc', xoops_utf8_encode(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
$tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
$tpl->assign('channel_webmaster', checkEmail($xoopsConfig['adminmail'], true));
// Fed up with spam
$tpl->assign('channel_editor', checkEmail($xoopsConfig['adminmail'], true));
// Fed up with spam
$tpl->assign('channel_category', 'News');
$tpl->assign('channel_generator', 'XOOPS');
$tpl->assign('channel_language', _LANGCODE);
$tpl->assign('image_url', XOOPS_URL . '/images/logo.gif');
示例3: list
//.........这里部分代码省略.........
$arr = $xoopsblock->getAllBlocksByGroup($this->plugin_xoopsblock_getByType("Anonymous"));
}
}
$ret = "";
if ($tgt == "?") {
foreach ($arr as $myblock) {
$block = array();
$block_type = @$myblock->getVar("type") ? $myblock->getVar("type") : $myblock->getVar("block_type");
$name = @$myblock->getVar("title") ? $myblock->getVar("title") : $myblock->getVar("name");
$bid = $myblock->getVar('bid');
$ret .= "<li>(" . $bid . ")" . $name . "</li>";
}
} else {
global $xoopsTpl;
require_once XOOPS_ROOT_PATH . '/class/template.php';
$xoopsTpl = new XoopsTpl();
if (is_object($xoopsUser)) {
$xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUser->isAdmin()));
}
$xoopsTpl->assign('xoops_requesturi', htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES));
foreach ($tgt_bids as $bid) {
$myblock = new XoopsBlock($bid);
$_bid = $myblock->getVar('bid');
if (!empty($_bid)) {
$bcachetime = $myblock->getVar('bcachetime');
// Only a guest enable cache. by nao-pon
//if (empty($bcachetime)) {
if ($bcachetime % 10 == 1) {
$bcachetime_guest = TRUE;
$bcachetime = $bcachetime - 1;
} else {
$bcachetime_guest = FALSE;
}
if (empty($bcachetime) || is_object($xoopsUser) && $bcachetime_guest) {
//if (empty($bcachetime)) {
$xoopsTpl->xoops_setCaching(0);
} else {
$xoopsTpl->xoops_setCaching(2);
$xoopsTpl->xoops_setCacheTime($bcachetime);
}
$btpl = $myblock->getVar('template');
if ($btpl != '') {
if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl, 'blk_' . $myblock->getVar('bid'))) {
//$xoopsLogger->addBlock($myblock->getVar('name'));
$bresult = $myblock->buildBlock();
if (!$bresult) {
continue;
}
$xoopsTpl->assign_by_ref('block', $bresult);
$bcontent = $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $myblock->getVar('bid'));
$xoopsTpl->clear_assign('block');
} else {
//$xoopsLogger->addBlock($myblock->getVar('name'), true, $bcachetime);
$bcontent = $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $myblock->getVar('bid'));
}
} else {
//$bid = $myblock->getVar('bid');
if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) {
//$xoopsLogger->addBlock($myblock->getVar('name'));
$bresult = $myblock->buildBlock();
if (!$bresult) {
continue;
}
$xoopsTpl->assign_by_ref('dummy_content', $bresult['content']);
$bcontent = $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
$xoopsTpl->clear_assign('block');
} else {
//$xoopsLogger->addBlock($myblock->getVar('name'), true, $bcachetime);
$bcontent = $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
}
}
$btitle = $myblock->getVar('title');
} else {
$btitle = "Block({$bid})";
$bcontent = "Block({$bid}) is not found.";
}
if ($bcontent) {
$ret .= "<h5>" . $btitle . "</h5>\n";
$ret .= $bcontent;
foreach (explode("\n", $xoopsTpl->get_template_vars('xoops_block_header')) as $str) {
$this->root->head_tags[] = rtrim($str);
}
foreach (explode("\n", $xoopsTpl->get_template_vars('xoops_module_header')) as $str) {
$this->root->head_tags[] = rtrim($str);
}
$this->root->head_tags = array_unique($this->root->head_tags);
}
}
unset($myblock);
}
if (!$css_show) {
$css_show = true;
$this->root->head_pre_tags[] = "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" . XOOPS_URL . "/xoops.css\" />";
}
if ($tgt == "?") {
$ret = "<ul>{$ret}</ul>";
}
unset($xoopsblock, $xoopsgroup);
return "<div{$style}>{$ret}</div>{$clear}";
}
示例4: htmlspecialchars
$xoopsTpl->assign('xoops_pagetitle', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES));
$xoopsTpl->assign('xoops_dirname', "system");
$moduleid = 0;
if (!empty($xoopsOption['show_cblock'])) {
$toppage = true;
}
}
// Get blocks
$block_arr =& $xoopsblock->getAllByGroupModule($groups, $moduleid, $toppage, XOOPS_BLOCK_VISIBLE);
foreach (array_keys($block_arr) as $i) {
$bcachetime = $block_arr[$i]->getVar('bcachetime');
if (empty($bcachetime)) {
$xoopsTpl->xoops_setCaching(0);
} else {
$xoopsTpl->xoops_setCaching(2);
$xoopsTpl->xoops_setCacheTime($bcachetime);
}
$btpl = $block_arr[$i]->getVar('template') != '' ? $block_arr[$i]->getVar('template') : "system_block_dummy.html";
if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'))) {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
$bresult =& $block_arr[$i]->buildBlock();
if (!$bresult) {
continue;
}
$xoopsTpl->assign_by_ref('block', $bresult);
$bcontent =& $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'));
$xoopsTpl->clear_assign('block');
} else {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
$bcontent =& $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'));
}
示例5: isset
require 'header.php';
require_once XOOPS_ROOT_PATH . '/class/template.php';
if (oledrion_utils::getModuleOption('use_rss') == 0) {
exit;
}
// Paramètre, soit rien auquel cas on prend tous les produits récents soit cat_cid
$cat_cid = isset($_GET['cat_cid']) ? intval($_GET['cat_cid']) : 0;
if (function_exists('mb_http_output')) {
mb_http_output('pass');
}
$charset = 'utf-8';
header('Content-Type:text/xml; charset=' . $charset);
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
// 1 = Cache global, 2 = Cache individuel (par template)
$tpl->xoops_setCacheTime(OLEDRION_RSS_CACHE);
// Temps de cache en secondes
if (!$tpl->is_cached('db:oledrion_rss.tpl', $cat_cid)) {
$categoryTitle = '';
if (!empty($cat_cid)) {
$category = null;
$category = $h_oledrion_cat->get($cat_cid);
if (is_object($category)) {
$categoryTitle = $category->getVar('cat_title');
}
}
$sitename = htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES);
$email = checkEmail($xoopsConfig['adminmail'], true);
$slogan = htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES);
$limit = oledrion_utils::getModuleOption('perpage');
$tpl->assign('charset', $charset);
示例6: make_cblock
function make_cblock()
{
global $xoopsUser, $xoopsOption;
$xoopsblock = new XoopsBlock();
$cc_block = $cl_block = $cr_block = "";
$arr = array();
if ($xoopsOption['theme_use_smarty'] == 0) {
if (!isset($GLOBALS['xoopsTpl']) || !is_object($GLOBALS['xoopsTpl'])) {
include_once XOOPS_ROOT_PATH . '/class/template.php';
$xoopsTpl = new XoopsTpl();
} else {
$xoopsTpl =& $GLOBALS['xoopsTpl'];
}
if (is_object($xoopsUser)) {
$block_arr = $xoopsblock->getAllBlocksByGroup($xoopsUser->getGroups(), true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE);
} else {
$block_arr = $xoopsblock->getAllBlocksByGroup(XOOPS_GROUP_ANONYMOUS, true, XOOPS_CENTERBLOCK_ALL, XOOPS_BLOCK_VISIBLE);
}
$block_count = count($block_arr);
$xoopsLogger =& XoopsLogger::instance();
for ($i = 0; $i < $block_count; $i++) {
$bcachetime = intval($block_arr[$i]->getVar('bcachetime'));
if (empty($bcachetime)) {
$xoopsTpl->xoops_setCaching(0);
} else {
$xoopsTpl->xoops_setCaching(2);
$xoopsTpl->xoops_setCacheTime($bcachetime);
}
$btpl = $block_arr[$i]->getVar('template');
if ($btpl != '') {
if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl)) {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
$bresult =& $block_arr[$i]->buildBlock();
if (!$bresult) {
continue;
}
$xoopsTpl->assign_by_ref('block', $bresult);
$bcontent =& $xoopsTpl->fetch('db:' . $btpl);
$xoopsTpl->clear_assign('block');
} else {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
$bcontent =& $xoopsTpl->fetch('db:' . $btpl);
}
} else {
$bid = $block_arr[$i]->getVar('bid');
if (empty($bcachetime) || !$xoopsTpl->is_cached('db:system_dummy.html', 'blk_' . $bid)) {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
$bresult =& $block_arr[$i]->buildBlock();
if (!$bresult) {
continue;
}
$xoopsTpl->assign_by_ref('dummy_content', $bresult['content']);
$bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
$xoopsTpl->clear_assign('block');
} else {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
$bcontent =& $xoopsTpl->fetch('db:system_dummy.html', 'blk_' . $bid);
}
}
$title = $block_arr[$i]->getVar('title');
switch ($block_arr[$i]->getVar('side')) {
case XOOPS_CENTERBLOCK_CENTER:
if ($title != "") {
$cc_block .= '<tr valign="top"><td colspan="2"><strong>' . $title . '</strong><hr />' . $bcontent . '<br /><br /></td></tr>' . "\n";
} else {
$cc_block .= '<tr><td colspan="2">' . $bcontent . '<br /><br /></td></tr>' . "\n";
}
break;
case XOOPS_CENTERBLOCK_LEFT:
if ($title != "") {
$cl_block .= '<p><strong>' . $title . '</strong><hr />' . $bcontent . '</p>' . "\n";
} else {
$cl_block .= '<p>' . $bcontent . '</p>' . "\n";
}
break;
case XOOPS_CENTERBLOCK_RIGHT:
if ($title != "") {
$cr_block .= '<p><strong>' . $title . '</strong><hr />' . $bcontent . '</p>' . "\n";
} else {
$cr_block .= '<p>' . $bcontent . '</p>' . "\n";
}
break;
default:
break;
}
unset($bcontent, $title);
}
echo '<table width="100%">' . $cc_block . '<tr valign="top"><td width="50%">' . $cl_block . '</td><td width="50%">' . $cr_block . '</td></tr></table>' . "\n";
}
}
示例7: XoopsTpl
<?php
require_once XOOPS_ROOT_PATH . '/class/template.php';
header('Content-Type: text/javascript');
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(60 * 60 * 24 * 7);
$tpl->display("db:{$mydirname}_javascript.html");
示例8: isset
require 'header.php';
require_once XOOPS_ROOT_PATH . '/class/template.php';
if (myshop_utils::getModuleOption('use_rss') == 0) {
exit;
}
// Last cat_cid
$cat_cid = isset($_GET['cat_cid']) ? intval($_GET['cat_cid']) : 0;
if (function_exists('mb_http_output')) {
mb_http_output('pass');
}
$charset = 'utf-8';
header('Content-Type:text/xml; charset=' . $charset);
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
// 1 = Global Cache, 2 = Individual Cache (by template)
$tpl->xoops_setCacheTime(MYSHOP_RSS_CACHE);
// Time cache in seconds
if (!$tpl->is_cached('db:myshop_rss.html', $cat_cid)) {
$categoryTitle = '';
if (!empty($cat_cid)) {
$category = null;
$category = $h_myshop_cat->get($cat_cid);
if (is_object($category)) {
$categoryTitle = $category->getVar('cat_title');
}
}
$sitename = htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES);
$email = checkEmail($xoopsConfig['adminmail'], true);
$slogan = htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES);
$limit = myshop_utils::getModuleOption('perpage');
$tpl->assign('charset', $charset);
示例9: XoopsBlock
$block = new XoopsBlock($myrow);
}
$block_arr[$myrow['bid']] = $block;
}
}
$adminmenublock_exists = false;
foreach (array_keys($block_arr) as $i) {
if ($block_arr[$i]->getVar('show_func') == 'b_altsys_admin_menu_show') {
$adminmenublock_exists = true;
}
$bcachetime = $block_arr[$i]->getVar('bcachetime');
if (empty($bcachetime)) {
$xoopsTpl->xoops_setCaching(0);
} else {
$xoopsTpl->xoops_setCaching(2);
$xoopsTpl->xoops_setCacheTime($bcachetime);
}
$btpl = $block_arr[$i]->getVar('template');
if ($btpl != '') {
if (empty($bcachetime) || !$xoopsTpl->is_cached('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'))) {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'));
$bresult = $block_arr[$i]->buildBlock();
if (!$bresult) {
continue;
}
$xoopsTpl->assign_by_ref('block', $bresult);
$bcontent = $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'));
$xoopsTpl->clear_assign('block');
} else {
$xoopsLogger->addBlock($block_arr[$i]->getVar('name'), true, $bcachetime);
$bcontent = $xoopsTpl->fetch('db:' . $btpl, 'blk_' . $block_arr[$i]->getVar('bid'));
示例10: empty
if (in_array($forum, array_keys($available_forums))) {
$valid_forums[] = $forum;
}
}
} else {
$valid_forums = array_keys($available_forums);
}
unset($available_forums);
if (count($valid_forums) == 0) {
exit;
}
$charset = empty($xoopsModuleConfig['rss_utf8']) ? _CHARSET : 'UTF-8';
header('Content-Type:text/xml; charset=' . $charset);
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(1);
$tpl->xoops_setCacheTime($xoopsModuleConfig['rss_cachetime'] * 60);
$compile_id = implode(",", $valid_forums);
$xoopsCachedTemplateId = 'mod_' . $xoopsModule->getVar('dirname') . '|' . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri']));
if (!$tpl->is_cached('db:newbb_rss.html', $xoopsCachedTemplateId, $compile_id)) {
$xmlrss_handler =& xoops_getmodulehandler('xmlrss', 'newbb');
$rss = $xmlrss_handler->create();
$rss->setVarRss('channel_title', $xoopsConfig['sitename'] . ' :: ' . _MD_FORUM);
$rss->channel_link = XOOPS_URL . '/';
$rss->setVarRss('channel_desc', $xoopsConfig['slogan'] . ' :: ' . $xoopsModule->getInfo('description'));
// There is a "bug" with xoops function formatTimestamp(time(), 'rss')
// We have to make a customized function
//$rss->channel_lastbuild = formatTimestamp(time(), 'rss');
$rss->setVarRss('channel_lastbuild', newbb_formatTimestamp(time(), 'rss'));
$rss->channel_webmaster = $xoopsConfig['adminmail'];
$rss->channel_editor = $xoopsConfig['adminmail'];
$rss->setVarRss('channel_category', $xoopsModule->getVar('name'));
示例11: XoopsTpl
}
if (function_exists('mb_http_output')) {
mb_http_output('pass');
}
$restricted = nw_getmoduleoption('restrictindex', NW_MODULE_DIR_NAME);
$newsnumber = nw_getmoduleoption('storyhome', NW_MODULE_DIR_NAME);
$charset = 'utf-8';
header ('Content-Type:text/xml; charset='.$charset);
$story = new nw_NewsStory();
$tpl = new XoopsTpl();
$tpl->xoops_setCaching(2);
$tpl->xoops_setCacheTime(3600); // Change this to the value you want
if (!$tpl->is_cached('db:nw_news_rss.html', $topicid)) {
$xt = new nw_NewsTopic($topicid);
$sarray = $story->getAllPublished($newsnumber, 0, $restricted, $topicid);
if (is_array($sarray) && count($sarray)>0) {
$sitename = htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES);
$slogan = htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES);
$tpl->assign('channel_title', xoops_utf8_encode($sitename));
$tpl->assign('channel_link', XOOPS_URL.'/');
$tpl->assign('channel_desc', xoops_utf8_encode($slogan));
$tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
$tpl->assign('channel_webmaster', checkEmail($xoopsConfig['adminmail'],true)); // Fed up with spam
$tpl->assign('channel_editor', checkEmail($xoopsConfig['adminmail'],true)); // Fed up with spam
$tpl->assign('channel_category', $xt->topic_title());
$tpl->assign('channel_generator', 'XOOPS');
$tpl->assign('channel_language', _LANGCODE);