怎么获取首页最近半年热门文章? [复制链接]

帖子链接已复制到剪贴板
chenmo (UID: 3151) 2022-10-13

1982 2

我用的是JOE主题,在widget.php里修改代码如下:

<?php
class Widget_Contents_Hot extends Widget_Abstract_Contents
{
    public function execute()
    {
        $this->parameter->setDefault(array('pageSize' => 10));
        $select = $this->select();
        $select->cleanAttribute('fields');
    //    $period = time() - 2592000; // 单位: 秒, 时间范围: 30天
     $period = strtotime("-180 days"); 
        $this->db->fetchAll(
            $select->from('table.contents')
                ->where("table.contents.password IS NULL OR table.contents.password = ''")
                ->where('table.contents.status = ?', 'publish')
                
                ->where('table.contents.created > ?','$period')
                ->where('table.contents.type = ?', 'post')
                ->limit($this->parameter->pageSize)
                ->order('table.contents.views', Typecho_Db::SORT_DESC),
            array($this, 'push')
        );
    }
}

怎么修改都没效果,有大佬指导一下吗?

这家伙太懒了,什么也没留下。
已有评论 (2)
提示:您必须 登录 才能查看此内容。
创建新帖
广告推广点击空位自助购买