wwwdsd:文章总数

模板开发以及发布测试

版主: seita

回复
头像
ClayMore
帖子: 2483
注册时间: 2007年 11月 29日 02:55
来自: Sleeping Forest
联系:

wwwdsd:文章总数

帖子 ClayMore »

<?php $rs=$this->db->fetchRow($this->db->select(array('COUNT(cid)' => 'total'))->from('table.contents')
->where('table.contents.status = ?', 'publish')
->where('table.contents.type = ?', 'post'));
$total=$rs['total'];?>
<?php echo $total;?>
头像
zyzzc
帖子: 648
注册时间: 2009年 9月 25日 20:11
联系:

Re: wwwdsd:文章总数

帖子 zyzzc »

模版中直接调用

代码: 全选

<?php $stat = Typecho_Widget::widget('Widget_Stat') ;echo ".$stat->PublishedPostsNum."; ?>
即可输出总文章数
头像
ClayMore
帖子: 2483
注册时间: 2007年 11月 29日 02:55
来自: Sleeping Forest
联系:

Re: wwwdsd:文章总数

帖子 ClayMore »

欢迎继续挖掘更多的化复杂为简
wwwdsd
帖子: 262
注册时间: 2009年 6月 13日 23:06
联系:

Re: wwwdsd:文章总数

帖子 wwwdsd »

还没注意有'Widget_Stat'这个东东,牛啊
各种统计都有
回复