作为一个新手,完全搞不懂wecenter,我在explore的目录下找到了取问题列表的这个代码$this->posts_list as $key => $val 。。。。 现在我想在上面添加条件,比如只取出前10条,或者只取出回答数最多的前10条,该去哪修改?
根据自己的理解,在app/explore目录下找到这句,绝得应该是他调用的
$posts_list = $this->model('posts')->get_posts_list($_GET['post_type'], $_GET['page'], $per_page, $_GET['sort_type'], $topic_ids, $_GET['category'], $_GET['answer_count'], $_GET['day'], $_GET['is_recommend']);
然后又找到models下的post.php里面的,自己尝试把里面的per_page = 10改成了110,以为调用会变多,想确定是不是这句话,结果页面显示并没有变化,难道不是这句代码?
public function get_posts_list($post_type, $page = 1, $per_page = 110, $sort = null, $topic_ids = null, $category_id = null, $answer_count = null, $day = 30, $is_recommend = false){...}
哎~原谅找错文件了,在app/explore下是main.php文件里面才对
else
{
$posts_list = $this->model('posts')->get_posts_list(null, $_GET['page'], get_setting('contents_per_page'), $_GET['sort_type'], null, $category_info['id'], $_GET['answer_count'], $_GET['day'], $_GET['is_recommend']);
}
if ($posts_list)
{
foreach ($posts_list AS $key => $val)
{
if ($val['answer_count'])
{
$posts_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']);
}
}
}
文件找对了,代码还是搞不懂,哈哈
阅读全文
收起全文