zblogphp怎么调用整站浏览总数、文章总数、标签、评论总数
不管是cms类型的主题还是博客、企业等类型的zblog主题模板,免不了要调用一些常见的数据,比如整站的文章总数、浏览量总数、tags和评论总数,通常来说可以直接把之前老版本的调用方法拿来使用(新版本好像有的不生效了,注意自行测试)
文章总数:{$zbp->cache->all_article_nums};
页面总数:{$zbp->cache->all_page_nums};
标签总数:{$zbp->cache->all_tags_nums};
浏览总数:{$zbp->cache->all_views_nums};
评论总数:{$zbp->cache->all_comments_nums};
页面总数:{$zbp->cache->all_page_nums};
标签总数:{$zbp->cache->all_tags_nums};
浏览总数:{$zbp->cache->all_views_nums};
评论总数:{$zbp->cache->all_comments_nums};
稳妥起见也可以自己查询数据库来调用
{php}
$all_airticle = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Post'] . ' WHERE log_Type=\'0\''), 'num');
$all_comments = $zbp->cache->all_comment_nums;
$all_views= $zbp->option['ZC_VIEWNUMS_TURNOFF'] == true ? 0 : GetValueInArrayByCurrent($zbp->db->Query('SELECT SUM(log_ViewNums) AS num FROM ' . $GLOBALS['table']['Post']), 'num');
{/php}
$all_airticle = GetValueInArrayByCurrent($zbp->db->Query('SELECT COUNT(*) AS num FROM ' . $GLOBALS['table']['Post'] . ' WHERE log_Type=\'0\''), 'num');
$all_comments = $zbp->cache->all_comment_nums;
$all_views= $zbp->option['ZC_VIEWNUMS_TURNOFF'] == true ? 0 : GetValueInArrayByCurrent($zbp->db->Query('SELECT SUM(log_ViewNums) AS num FROM ' . $GLOBALS['table']['Post']), 'num');
{/php}
到zblogphp的前端模板里直接给出,直接调用
<div>本站总文章数:{$all_airticle}</div>
<div>本站总评论数:{$all_comments}</div>
<div>本站总阅读数:{$all_views}</div>
<div>本站总评论数:{$all_comments}</div>
<div>本站总阅读数:{$all_views}</div>