zoukankan      html  css  js  c++  java
  • 如何把wecenter的推荐的问题模块单独调取出来?

    查阅文档:

    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>

  • 相关阅读:
    MongoDB入门(1)--安装配置
    数据结构课程设计--平衡二叉树
    站立会议
    NABCD
    返回最大子数和(首位相连)
    返回一个数组中的最大子数组和
    最大数组BT
    最大数组
    时间记录日志
    四则运算的问题
  • 原文地址:https://www.cnblogs.com/tanlingdangan/p/4435382.html
Copyright © 2011-2022 走看看