码迷,mamicode.com
首页 > 其他好文 > 详细

如何把wecenter的推荐的问题模块单独调取出来?

时间:2015-04-17 17:50:09      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:

查阅文档:

http://wenda.wecenter.com/question/1893

http://www.zhidiu.com/article/1012

http://wenda.wecenter.com/question/14010

http://wenda.wecenter.com/article/1253

1,在app/explore/main.php下添加

//99行添加模块
if (TPL::is_output(‘block/content_index.tpl.htm‘, ‘explore/index‘))
{
// $posts_list = $this->model(‘posts‘)->get_hot_posts(null, $category_info[‘id‘], null, $_GET[‘is_recommend‘], $_GET[‘page‘], 12);
$posts_list = $this->model(‘posts‘)->get_posts_list(question, $page = 1, $per_page = 10, $sort = null, $topic_ids = null, $category_id = null, $answer_count = null, $day = 30, $is_recommend = true);
TPL::assign(‘recommend_posts_list‘, $posts_list);
}
//添加模块,为什么用get_posts_list(),可查阅POST方法,在models/xx文件

 

2,新建模块文件:views/default/block/content_index.tpl.htm,内容为:

<div class="main">
<div class="focus">
<h2>精选问答</h2>
<ul>
<?php foreach ($this->recommend_posts_list AS $key => $val) { ?>
<li><a href="question/<?php echo $val[‘question_id‘]; ?>"><?php echo $val[‘question_content‘]; ?></a></a></li>
<?php } ?>
</ul>
</div>
</div>

 

如何把wecenter的推荐的问题模块单独调取出来?

标签:

原文地址:http://www.cnblogs.com/tanlingdangan/p/4435382.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!