诺兰网 - 只为资源而生-分享永无止境 - 专注优质源码/电脑软件/活动资讯/技术教程分享

诺兰网投稿 1

给emlog主题添加统计栏目代码及教程

编辑:诺兰网 分类:emlog教程 首发 阅读量:422 次
扫码手机访问
0
摘要:给emlog主题添加统计栏目代码及教程 最近很多大佬都在问,那个统计代码怎么放,我怎么放了没有用呀,听到这些,我也不想说了,下面直接给你们丢代码,喜欢花里胡哨的站长你们要的东西它来了。…… 首页调用代码,这...

emlog主题添加统计栏目代码教程

给emlog主题添加统计栏目代码及教程

给emlog主题添加统计栏目代码及教程

最近很多大佬都在问,那个统计代码怎么放,我怎么放了没有用呀,听到这些,我也不想说了,下面直接给你们丢代码,喜欢花里胡哨的站长你们要的东西它来了。……

首页调用代码,这里我用的是fee主题,那么直接丢到log_list.php文件里头,当然也有人会问具体丢哪里,因为有很多那种刚玩网站的”大佬”不知道加哪里,然而加了把网站也打不开的那种,只要记住代码丢<?php }?>后面基本会没错,具体放入位置,个人喜欢吧

<!--统计栏目-->
<div class="tpt-wp cl">
<ul>
<li class="tpt-md-4"><div class="tpt-cm">
<i class="layui-icon fa fa-folder-open-o" style="font-size: 20px; color: #e4ad85;vertical-align: middle;
 margin: 0px 3px;"></i>文章资源 <font color="#03f"><?php echo $sta_cache['lognum']; ?></font> 篇</div>
</li>
<li class="tpt-md-4"><div class="tpt-cm">
<i class="layui-icon fa fa-commenting-o" style="font-size: 20px; color: #27c24c;vertical-align: middle;
 margin: 0px 3px;"></i>评论回复 <font color="#03f"><?php echo $sta_cache['comnum_all']; ?></font> 次</div>
</li>
<li class="tpt-md-4"><div class="tpt-cm">
<i class="layui-icon fa fa-user-o" style="font-size: 20px; color: #23b7e5;vertical-align: middle;
 margin: 0px 3px;"></i>网站用户 <font color="#03f"><?php echo count_user_all();?> </font>位</div>
</li>
<li class="tpt-md-4"><div class="tpt-cm">
<i class="layui-icon fa fa-history" style="font-size: 20px; color: #7266ba;vertical-align: middle;
 margin: 0px 3px;"></i>最后更新 <font color="#ff0000"><?php echo last_post_log();?></font></a ></div>
</li>
</ul>
</div>

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; 
 };
?>
阅读时间:

字数统计:本文共有 4629 个字

本文标题:《给emlog主题添加统计栏目代码及教程》发布于2022-11-3 17:59:13

版权声明:文章由《诺兰网》发布、原创转载请保留出处!

本文链接:https://www.nuolanyl.com/post-2347.html

上一篇
Emlog开启https后侧边栏日历无法正常显示
下一篇
支付宝怎么赚取芝麻粒?(芝麻粒怎么赚钱)

免责声明:

本站提供的资源,都来自网络,版权争议与本站无关,所有内容及软件的文章仅限用于学习和研究目的。不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负,我们不保证内容的长久可用性,通过使用本站内容随之而来的风险与本站无关,您必须在下载后的24个小时之内,从您的电脑/手机中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。侵删请致信E-mail:2877741347@qq.com

同类推荐

最新文章

评论列表
签到

小姐姐视频

热门文章

随机推荐

标签云

emlog教程 给emlog主题添加统计栏目代码及教程
给emlog主题添加统计栏目代码及教程 最近很多大佬都在问,那个统计代码怎么放,我怎么放了没有用呀,听到这些,我也不想说了,下面直接给你们丢代码,喜欢...
扫描二维码阅读原文
诺兰网 January, 01
生成社交图 ×