欢迎您光临小易传媒工作室博客,本站秉承服务宗旨 履行“站长”责任,销售只是起点 服务永无止境!

emlog官方缓存类统计代码

先说调用代码:<?php $sta_cache = Cache::getInstance()->readCache(‘sta’);?>
<?php echo $sta_cache[‘内容’];?>
例如调用日志数量
<?php echo $sta_cache[‘lognum’];?>
注意了这里的日志数量是前台显示出来的日志数量,未包含未审核以及隐藏的文章数量。
lognum 游客可见日志总数
draftnum  草稿,也就是隐藏文件数量
comnum  未隐藏的评论数量
comnum_all  所有评论数量
hidecomnum  被隐藏的评论数量
twnum  微语数量
checknum 未审核的文章数量

缺点加载比较慢,把下面代码放入到模板module.php文件中

<?php //统计文章总数 function count_log_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “blog WHERE type = ‘blog'”); return $data[‘total’]; } //置顶文章数 function count_log_top(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “blog WHERE top = ‘y’ or sortop = ‘y’ AND type = ‘blog'”); return $data[‘total’]; } //隐藏文章数 function count_log_hide(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “blog WHERE hide = ‘y’ AND type = ‘blog'”); return $data[‘total’]; } //未审核文章数 function count_log_check(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “blog WHERE checked = ‘n’ AND type = ‘blog'”); return $data[‘total’]; } //加密文章数 function count_log_pass(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “blog WHERE password !=” AND type = ‘blog'”); return $data[‘total’]; } //统计页面总数 function count_page_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “blog WHERE type = ‘page'”); return $data[‘total’]; } //统计评论总数 function count_com_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “comment”); return $data[‘total’]; } //统计友链总数 function count_link_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “link”); return $data[‘total’]; } //统计微语评论总数 function count_treply_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “reply”); return $data[‘total’]; } //统计分类总数 function count_sort_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “sort”); return $data[‘total’]; } //统计子分类数 function count_sort_mod(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “sort WHERE pid != 0”); return $data[‘total’]; } //统计标签总数 function count_tag_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “tag”); return $data[‘total’]; } //统计微语总数 function count_tw_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “twitter”); return $data[‘total’]; } //统计用户总数 function count_user_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “user”); return $data[‘total’]; } //统计管理员总数 function count_user_admin(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “user WHERE role = ‘admin'”); return $data[‘total’]; } //统计作者总数 function count_user_writer(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “user WHERE role = ‘writer'”); return $data[‘total’]; } //统计附件总数 function count_att_all(){ $db = MySql::getInstance(); $data = $db->once_fetch_array(“SELECT COUNT(*) AS total FROM “ . DB_PREFIX . “attachment”); return $data[‘total’]; } //最后发表文章时间 function last_post_log(){ $db = MySql::getInstance(); $sql = “SELECT * FROM “ . DB_PREFIX . “blog WHERE type=’blog’ ORDER BY date DESC LIMIT 0,1”; $res = $db->query($sql); $row = $db->fetch_array($res); $date = date(‘Y-n-j H:i’,$row[‘date’]); return $date; };?>

在对应的位置插入<?php echo count_link_all();?>其中count_link_all()代表友链数量


小易传媒工作室资源网 » emlog官方缓存类统计代码
  • 169会员总数(位)
  • 922资源总数(个)
  • 1本周发布(个)
  • 0 今日发布(个)
  • 576稳定运行(天)

提供最优质的资源集合

立即查看 了解详情
升级VIP尊享更多特权立即升级
本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除 ? 1995-2021 侵权投诉邮箱:1076433326@qq.com
高新区小易传媒工作室蜀ICP备20002808号-2

网站首页 |投稿奖励 |友情链接 | 广告合作 | 网站地图 | 留言反馈 | 联系小易

?版权所有,盗版必究-|小易传媒工作室