本文整理汇总了PHP中tpl_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP tpl_cache函数的具体用法?PHP tpl_cache怎么用?PHP tpl_cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tpl_cache函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get() {
$id = isset($_GET['id']) && intval($_GET['id']) ? intval($_GET['id']) : exit();
if ($data = $this->db->get_one(array('id'=>$id))) {
if (!$str = tpl_cache('dbsource_'.$id,$data['cache'])) {
if ($data['type'] == 1) { //自定义SQL调用
$get_db = pc_base::load_model("get_model");
$sql = $data['data'].(!empty($data['num']) ? " LIMIT $data[num]" : '');
$r= $get_db->query($sql);
while(($s = $get_db->fetch_next()) != false) {
$str[] = $s;
}
} else {
$filepath = PC_PATH.'modules'.DIRECTORY_SEPARATOR.$data['module'].DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR.$data['module'].'_tag.class.php';
if (file_exists($filepath)) {
$pc_tag = pc_base::load_app_class($data['module'].'_tag', $data['module']);
if (!method_exists($pc_tag, $data['action'])) {
exit();
}
$sql = string2array($data['data']);
$sql['action'] = $data['action'];
$sql['limit'] = $data['num'];
unset($data['num']);
$str = $pc_tag->$data['action']($sql);
} else {
exit();
}
}
if ($data['cache']) setcache('dbsource_'.$id, $str, 'tpl_data');
}
echo $this->_format($data['id'], $str, $data['dis_type']);
}
}
示例2: init_lang_tpl
public static function init_lang_tpl()
{
$dir = PHPDISK_ROOT . 'system/global/';
make_dir($dir);
$file = $dir . 'lang_settings.inc.php';
file_exists($file) ? require_once $file : lang_cache();
$file = $dir . 'tpl_settings.inc.php';
file_exists($file) ? require_once $file : tpl_cache();
if (count($tpl_settings)) {
foreach ($tpl_settings as $v) {
if ($v[actived] && $v[tpl_type] == 'user') {
$user_tpl_dir = $v[tpl_name];
}
if ($v[actived] && $v[tpl_type] == 'admin') {
$admin_tpl_dir = $v[tpl_name];
}
}
}
if (count($lang_settings)) {
foreach ($lang_settings as $v) {
if ($v[actived]) {
$lang_name = $v[lang_name];
}
}
}
$user_tpl_dir = $user_tpl_dir ? "templates/{$user_tpl_dir}/" : 'templates/default/';
$admin_tpl_dir = $admin_tpl_dir ? "templates/{$admin_tpl_dir}/" : 'templates/admin/';
$lang_name = $lang_name ? $lang_name : 'zh_cn';
return array('user_tpl_dir' => $user_tpl_dir, 'admin_tpl_dir' => $admin_tpl_dir, 'lang_name' => $lang_name);
}
示例3: init_lang_tpl
public static function init_lang_tpl()
{
global $C, $settings, $auth;
$dir = PHPDISK_ROOT . 'system/global/';
make_dir($dir);
$file = $dir . 'lang_settings.inc.php';
file_exists($file) ? require_once $file : lang_cache();
$file = $dir . 'tpl_settings.inc.php';
file_exists($file) ? require_once $file : tpl_cache();
if (count($tpl_settings)) {
foreach ($tpl_settings as $v) {
if ($v[actived] && $v[tpl_type] == 'user') {
$user_tpl_dir = $v[tpl_name];
}
if ($v[actived] && $v[tpl_type] == 'admin') {
$admin_tpl_dir = $v[tpl_name];
}
}
}
if (count($lang_settings)) {
foreach ($lang_settings as $v) {
if ($v[actived]) {
$lang_name = $v[lang_name];
}
}
}
if ($settings[open_switch_tpls]) {
$ptpl = gpc('ptpl', 'C', '');
$user_tpl_dir = $C[tpl_name] = $ptpl ? check_template($ptpl) ? $ptpl : $user_tpl_dir : $user_tpl_dir;
//$C[tpl_name] = $user_tpl_dir;
}
$arr = get_template_info($user_tpl_dir);
$is_fms = $arr['template_core'] == 'fms' && $auth[open_fms] ? 1 : 0;
$user_tpl_dir = $user_tpl_dir ? "templates/{$user_tpl_dir}/" : 'templates/default/';
$admin_tpl_dir = $admin_tpl_dir ? "templates/{$admin_tpl_dir}/" : 'templates/admin/';
$lang_name = $lang_name ? $lang_name : 'zh_cn';
return array('user_tpl_dir' => $user_tpl_dir, 'admin_tpl_dir' => $admin_tpl_dir, 'lang_name' => $lang_name, 'fms' => $is_fms);
}
示例4: profilefield_cache
profilefield_cache();
profield_cache();
censor_cache();
block_cache();
eventclass_cache();
magic_cache();
click_cache();
task_cache();
ad_cache();
creditrule_cache();
userapp_cache();
app_cache();
network_cache();
}
//ģ����뻺��
if (empty($_POST['cachetype']) || in_array('tpl', $_POST['cachetype'])) {
tpl_cache();
}
//ģ�黺��
if (empty($_POST['cachetype']) || in_array('block', $_POST['cachetype'])) {
block_data_cache();
}
//��㿴������
if (empty($_POST['cachetype']) || in_array('network', $_POST['cachetype'])) {
$fiels = sreaddir(S_ROOT . './data', array('txt'));
foreach ($fiels as $value) {
@unlink(S_ROOT . './data/' . $value);
}
}
cpmessage('do_success', $turl);
}
示例5: md5
</ul>
<?php
if (defined('IN_ADMIN') && !defined('HTML')) {
echo '</div>';
}
?>
</div>
<div class="bk10"></div>
<div class="box">
<h5 class="title-2">一周评论排行</h5>
<?php
if (defined('IN_ADMIN') && !defined('HTML')) {
echo "<div class=\"admin_piao\" pc_action=\"comment\" data=\"op=comment&tag_md5=f96eff7c12a07eee88c5cd43c712bf7e&action=bang&cache=3600\"><a href=\"javascript:void(0)\" class=\"admin_piao_edit\">编辑</a>";
}
$tag_cache_name = md5(implode('&', array()) . 'f96eff7c12a07eee88c5cd43c712bf7e');
if (!($data = tpl_cache($tag_cache_name, 3600))) {
$comment_tag = pc_base::load_app_class("comment_tag", "comment");
if (method_exists($comment_tag, 'bang')) {
$data = $comment_tag->bang(array('limit' => '20'));
}
if (!empty($data)) {
setcache($tag_cache_name, $data, 'tpl_data');
}
}
?>
<ul class="content digg">
<?php
$n = 1;
if (is_array($data)) {
foreach ($data as $r) {
?>
示例6: if
<?php if($n%5==0) { ?><li class="bk20 hr"></li><?php } ?>
<?php $n++;}unset($n); ?>
</ul>
<div id="pages" class="text-c"><?php echo $pages;?></div>
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo '</div>';}?>
</div>
<div class="col-auto">
<div class="box">
<h5 class="title-2">ƵµÀ×ÜÅÅÐÐ</h5>
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo "<div class=\"admin_piao\" pc_action=\"content\" data=\"op=content&tag_md5=0ad40a45ad075d8f47798a231e25aec2&action=hits&catid=%24catid&num=10&order=views+DESC&cache=3600\"><a href=\"javascript:void(0)\" class=\"admin_piao_edit\">±à¼</a>";}$tag_cache_name = md5(implode('&',array('catid'=>$catid,'order'=>'views DESC',)).'0ad40a45ad075d8f47798a231e25aec2');if(!$data = tpl_cache($tag_cache_name,3600)){$content_tag = pc_base::load_app_class("content_tag", "content");if (method_exists($content_tag, 'hits')) {$data = $content_tag->hits(array('catid'=>$catid,'order'=>'views DESC','limit'=>'10',));}if(!empty($data)){setcache($tag_cache_name, $data, 'tpl_data');}}?>
<ul class="content digg">
<?php $n=1;if(is_array($data)) foreach($data AS $r) { ?>
<li><a href="<?php echo $r['url'];?>" target="_blank"><?php echo $r['title'];?></a></li>
<?php $n++;}unset($n); ?>
</ul>
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo '</div>';}?>
</div>
<div class="bk10"></div>
<div class="box">
<h5 class="title-2">ƵµÀ±¾ÔÂÅÅÐÐ</h5>
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo "<div class=\"admin_piao\" pc_action=\"content\" data=\"op=content&tag_md5=2caa10e576ba663010144233732308cd&action=hits&catid=%24catid&num=8&order=monthviews+DESC&cache=3600\"><a href=\"javascript:void(0)\" class=\"admin_piao_edit\">±à¼</a>";}$tag_cache_name = md5(implode('&',array('catid'=>$catid,'order'=>'monthviews DESC',)).'2caa10e576ba663010144233732308cd');if(!$data = tpl_cache($tag_cache_name,3600)){$content_tag = pc_base::load_app_class("content_tag", "content");if (method_exists($content_tag, 'hits')) {$data = $content_tag->hits(array('catid'=>$catid,'order'=>'monthviews DESC','limit'=>'8',));}if(!empty($data)){setcache($tag_cache_name, $data, 'tpl_data');}}?>
<ul class="content rank">
<?php $n=1;if(is_array($data)) foreach($data AS $r) { ?>
<li><span><?php echo number_format($r[monthviews]);?></span><a href="<?php echo $r['url'];?>"<?php echo title_style($r[style]);?> class="title" title="<?php echo $r['title'];?>"><?php echo str_cut($r[title],56,'...');?></a></li>
<?php $n++;}unset($n); ?>
</ul>
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo '</div>';}?>
</div>
</div>
</div>
<?php include template("content","footer"); ?>
示例7: if
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title><?php if(isset($SEO['title']) && !empty($SEO['title'])) { ?><?php echo $SEO['title'];?><?php } ?><?php echo $SEO['site_title'];?></title>
<meta name="keywords" content="<?php echo $SEO['keyword'];?>">
<meta name="description" content="<?php echo $SEO['description'];?>">
<link href="<?php echo CSS_PATH;?>reset.css" rel="stylesheet" type="text/css" />
<link href="<?php echo CSS_PATH;?>default_blue.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?php echo JS_PATH;?>jquery.min.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>jquery.sgallery.js"></script>
<script type="text/javascript" src="<?php echo JS_PATH;?>search_common.js"></script>
</head>
<body>
<div class="body-top">
<div class="content">
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo "<div class=\"admin_piao\" pc_action=\"content\" data=\"op=content&tag_md5=2e3bec5eab254972ef7678fb28fb15b9&action=position&posid=9&order=id&num=10&cache=3600\"><a href=\"javascript:void(0)\" class=\"admin_piao_edit\">修改</a>";}$tag_cache_name = md5(implode('&',array('posid'=>'9','order'=>'id',)).'2e3bec5eab254972ef7678fb28fb15b9');if(!$data = tpl_cache($tag_cache_name,3600)){$content_tag = pc_base::load_app_class("content_tag", "content");if (method_exists($content_tag, 'position')) {$data = $content_tag->position(array('posid'=>'9','order'=>'id','limit'=>'10',));}if(!empty($data)){setcache($tag_cache_name, $data, 'tpl_data');}}?>
<div id="announ">
<ul>
<?php $n=1; if(is_array($data)) foreach($data AS $k => $v) { ?>
<li><a href="<?php echo $v['url'];?>"><?php echo $v['title'];?></a></li>
<?php $n++;}unset($n); ?>
</ul>
</div>
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo '</div>';}?>
<?php echo runhook('glogal_header')?>
<script type="text/javascript">
$(function(){
startmarquee('announ',22,1,500,3000);
})
</script>
<div class="login lh24 blue"><a href="<?php echo APP_PATH;?>index.php?m=content&c=rss&siteid=<?php echo get_siteid();?>" class="rss ib">rss</a><span class="rt"><script type="text/javascript">document.write('<iframe src="<?php echo APP_PATH;?>index.php?m=member&c=index&a=mini&forward='+encodeURIComponent(location.href)+'&siteid=<?php echo get_siteid();?>" allowTransparency="true" width="500" height="24" frameborder="0" scrolling="no"></iframe>')</script></span></div>
示例8: if
<div class="col-auto">
<div class="box">
<h5 class="title-2">频道总排行</h5>
<ul class="content digg">
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo "<div class=\"admin_piao\" pc_action=\"content\" data=\"op=content&tag_md5=58900d29a2d86f6669bfff23ba8fcaf2&action=hits&catid=%24catid&num=10&order=views+DESC&cache=3600\"><a href=\"javascript:void(0)\" class=\"admin_piao_edit\">编辑</a>";}$tag_cache_name = md5(implode('&',array('catid'=>$catid,'order'=>'views DESC',)).'58900d29a2d86f6669bfff23ba8fcaf2');if(!$data = tpl_cache($tag_cache_name,3600)){$content_tag = pc_base::load_app_class("content_tag", "content");if (method_exists($content_tag, 'hits')) {$data = $content_tag->hits(array('catid'=>$catid,'order'=>'views DESC','limit'=>'10',));}if(!empty($data)){setcache($tag_cache_name, $data, 'tpl_data');}}?>
<?php $n=1;if(is_array($data)) foreach($data AS $r) { ?>
<li><a href="<?php echo $r['url'];?>" target="_blank" title="<?php echo $r['title'];?>"><?php echo str_cut($r[title], 28, '');?></a></li>
<?php $n++;}unset($n); ?>
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo '</div>';}?>
</ul>
</div>
<div class="bk10"></div>
<div class="box">
<h5 class="title-2">频道本月排行</h5>
<ul class="content rank">
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo "<div class=\"admin_piao\" pc_action=\"content\" data=\"op=content&tag_md5=d09a3bdd996817c252fccd081b70bebc&action=hits&catid=%24catid&num=10&order=monthviews+DESC&cache=3600\"><a href=\"javascript:void(0)\" class=\"admin_piao_edit\">编辑</a>";}$tag_cache_name = md5(implode('&',array('catid'=>$catid,'order'=>'monthviews DESC',)).'d09a3bdd996817c252fccd081b70bebc');if(!$data = tpl_cache($tag_cache_name,3600)){$content_tag = pc_base::load_app_class("content_tag", "content");if (method_exists($content_tag, 'hits')) {$data = $content_tag->hits(array('catid'=>$catid,'order'=>'monthviews DESC','limit'=>'10',));}if(!empty($data)){setcache($tag_cache_name, $data, 'tpl_data');}}?>
<?php $n=1;if(is_array($data)) foreach($data AS $r) { ?>
<li><span><?php echo number_format($r[monthviews]);?></span><a href="<?php echo $r['url'];?>"<?php echo title_style($r[style]);?> class="title" title="<?php echo $r['title'];?>"><?php echo str_cut($r[title],56,'...');?></a></li>
<?php $n++;}unset($n); ?>
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo '</div>';}?>
</ul>
</div>
</div>
</div>
<script type="text/javascript">
<!--
function show_ajax(obj) {
var keywords = $(obj).text();
var offset = $(obj).offset();
var jsonitem = '';
$.getJSON("<?php echo APP_PATH;?>index.php?m=content&c=index&a=json_list&type=keyword&modelid=<?php echo $modelid;?>&id=<?php echo $id;?>&keywords="+encodeURIComponent(keywords),
示例9: if
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo '</div>';}?>
</div>
</div>
<div class="bk10"></div>
<div class="box">
<h5 class="title-2"><span class="rt fn f12 tab SwapTab"><span class="fb">热点</span> | <span >评论</span> | <span>关注</span></span>排行</h5>
<div class="tab-content">
<ul class="content digg">
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo "<div class=\"admin_piao\" pc_action=\"content\" data=\"op=content&tag_md5=97849c6fb7d3e0f9a0891295340b6456&action=hits&catid=6&num=10&order=views+DESC\"><a href=\"javascript:void(0)\" class=\"admin_piao_edit\">修改</a>";}$content_tag = pc_base::load_app_class("content_tag", "content");if (method_exists($content_tag, 'hits')) {$data = $content_tag->hits(array('catid'=>'6','order'=>'views DESC','limit'=>'10',));}?>
<?php $n=1;if(is_array($data)) foreach($data AS $r) { ?>
<li><a href="<?php echo $r['url'];?>" target="_blank" title="<?php echo $r['title'];?>"<?php echo title_style($r[style]);?>><?php echo $r['title'];?></a></li>
<?php $n++;}unset($n); ?>
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo '</div>';}?>
</ul>
<ul class="content digg hidden">
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo "<div class=\"admin_piao\" pc_action=\"comment\" data=\"op=comment&tag_md5=55e75bfad540869982aca092575756e4&action=bang&num=10&cache=3600\"><a href=\"javascript:void(0)\" class=\"admin_piao_edit\">修改</a>";}$tag_cache_name = md5(implode('&',array()).'55e75bfad540869982aca092575756e4');if(!$data = tpl_cache($tag_cache_name,3600)){$comment_tag = pc_base::load_app_class("comment_tag", "comment");if (method_exists($comment_tag, 'bang')) {$data = $comment_tag->bang(array('limit'=>'10',));}if(!empty($data)){setcache($tag_cache_name, $data, 'tpl_data');}}?>
<?php $n=1;if(is_array($data)) foreach($data AS $r) { ?>
<li><a href="<?php echo $r['url'];?>" target="_blank"><?php echo $r['title'];?></a></li>
<?php $n++;}unset($n); ?>
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo '</div>';}?>
</ul>
<ul class="content digg hidden">
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo "<div class=\"admin_piao\" pc_action=\"content\" data=\"op=content&tag_md5=97849c6fb7d3e0f9a0891295340b6456&action=hits&catid=6&num=10&order=views+DESC\"><a href=\"javascript:void(0)\" class=\"admin_piao_edit\">修改</a>";}$content_tag = pc_base::load_app_class("content_tag", "content");if (method_exists($content_tag, 'hits')) {$data = $content_tag->hits(array('catid'=>'6','order'=>'views DESC','limit'=>'10',));}?>
<?php $n=1;if(is_array($data)) foreach($data AS $r) { ?>
<li><a href="<?php echo $r['url'];?>" target="_blank"><?php echo $r['title'];?></a></li>
<?php $n++;}unset($n); ?>
<?php if(defined('IN_ADMIN') && !defined('HTML')) {echo '</div>';}?>
</ul>
</div>
</div><div class="bk10"></div>
<div class="box">
示例10: unset
unset($data);
}
}
?>
</ul>
</div>
<div class="index_news index_help">
<h2>
<b>新手帮助</b>
<a href="index.php?c=news&a=lists&cid=2" title="信托快报-财来电">更多</a>
</h2>
<ul>
<?php
$tag_cache_name = md5(implode('&', array('cid' => '2')) . '7c30cffdf324ef9ff08c35d638bdfd6f');
if (!($data = tpl_cache($tag_cache_name))) {
if (!isset($CI)) {
$CI =& get_instance();
}
$CI->load->model("a_article_model");
if (method_exists($CI->a_article_model, 'get_article_list')) {
$data = $CI->a_article_model->get_article_list(array('cid' => '2', 'limit' => '20'));
}
if (!empty($data)) {
tpl_setcache($tag_cache_name, $data, 'a_article', 3600);
}
}
if (is_array($data)) {
foreach ($data as $v) {
?>
<li>