站点介绍
文章总数、分类总数、页面总数、标签总数、评论总数、浏览总数,可分别调用,详情看本站侧边博客统计信息!
代码:
第一步:打开主题模板include.php文件,找到合适的位置输出一下代码,将主题ID改成自己主题的ID;
//信息统计function 主题ID_all_views() { global $zbp;$all_views = GetValueInArrayByCurrent($zbp->db->Query('SELECT SUM(log_ViewNums) AS num FROM ' . $GLOBALS['table']['Post']), 'num');return $all_views;}function 主题ID_all_artiles() { global $zbp;$all_artiles = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Post'] . ' WHERE log_Type=\'0\''), 'num');return $all_artiles;}function 主题ID_all_pages() { global $zbp;$all_pages = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Post'] . ' WHERE log_Type=\'1\''), 'num');return $all_pages;}function 主题ID_all_categorys() { global $zbp;$all_categorys = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Category']), 'num');return $all_categorys;}function 主题ID_all_tags() { global $zbp;$all_tags = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) as num FROM ' . $GLOBALS['table']['Tag']), 'num');return $all_tags;}function 主题ID_all_comments() { global $zbp;$all_comments = $zbp->cache->all_comment_nums;return $all_comments;}第二步:将下面的统计代码放到想要展示统计的地方,可单独调用,放哪个显示哪个!
<p>文章总数:{主题ID_all_artiles()}</p><p>分类总数:{主题ID_all_categorys()}</p><p>页面总数:{主题ID_all_pages()}</p><p>标签总数:{主题ID_all_tags()}</p><p>评论总数:{主题ID_all_comments()}</p><p>总访问量:{主题ID_all_views()}</p>今天发布文章统计
function hongsexinxi_postNum(){ global $zbp; $nowtime = time();//当前时间 $settime = 1*24*60*60;//24小时时间 $gettime = $nowtime-$settime;//当前时间减24小时 $db = $zbp->db->sql->get(); $sql = $db->select('zbp_post')->where(array(array('=','log_Status','0'),array('>','log_PostTime',$gettime)))->sql; $array = $zbp->GetListType('Post', $sql); echo count($array); }本月待审核文章数:
function hongsexinxi_postNums(){ global $zbp; $nowtime = time();//当前时间 $settime = 30*24*60*60;//30天 $gettime = $nowtime-$settime;//当前时间减24小时 $db = $zbp->db->sql->get(); $sql = $db->select('zbp_post')->where(array(array('=','log_Status','2'),array('>','log_PostTime',$gettime)))->sql; $array = $zbp->GetListType('Post', $sql); echo count($array); }调用方法和上面一样!
<p>本月待审数:{hongsexinxi_postNums()}</p><p>今日发布总数:{hongsexinxi_postNum()}</p>