Ecshop 文章增加倒序

来源:互联网 发布:java覆盖变量 编辑:程序博客网 时间:2024/05/16 13:48

Ecshop添加新的文章不知道依照什么规则排序

现在按照发表时间排序

主要修改 \includes\lib_goods.php 文件

function index_get_class_articles($cat_aid, $cat_num)
{
    $sql = "Select article_id, title,open_type,cat_id,file_url FROM " .$GLOBALS['ecs']->table('article'). " Where cat_id = ".$cat_aid." and is_open = 1 LIMIT  " . $cat_num;
    $res = $GLOBALS['db']->getAll($sql);
    $arr = array();
    foreach ($res AS $idx => $row)

修改为

function index_get_class_articles($cat_aid, $cat_num)
{
    $sql = "Select article_id, title,open_type,cat_id,file_url FROM " .$GLOBALS['ecs']->table('article'). " Where cat_id = ".$cat_aid." and is_open = 1 order by article_id desc LIMIT 0," . $cat_num;
    $res = $GLOBALS['db']->getAll($sql);
    $arr = array();
    foreach ($res AS $idx => $row)

即可

我的商场上线了:http://www.wenjunlegou.com  CSDN的朋友买  全部打折

淘宝店铺 :http://wenjunguanwang.taobao.com/