7X24小时在线,建站仿站,提供空间域名及数据库,可淘宝交易!安全放心!

织梦首页文章按权重排序的方法(正序、倒序均可)

专职建站仿站2023-03-04 15:13:51333技术文章

首先要记住权重排序的标签是:orderby=‘weight’
  DEDE 5.7 首页【arclist】增加按权重排序
  在织梦系统中找到以下目录\include\taglib中的arclist.lib.php文件并打开;
  大约在170行找到

$innertext='', $arcid=0, $idlist='', $channelid=0, $limit='', $att='', $order='desc', $subday=0, $noflag='',$tagid='', $pagesize=0, $isweight='N')

把这里的$isweight='N'改为$isweight='Y'
  大约在340行上面找到

微信号:gaogaojie5
添加微信好友, 获取更多信息
复制微信号
    //文档排序的方式
    $ordersql = '';
    if($orderby=='hot' || $orderby=='click') $ordersql = " ORDER BY arc.click $orderWay";
    else if($orderby == 'sortrank' || $orderby=='pubdate') $ordersql = " ORDER BY arc.sortrank $orderWay";
    else if($orderby == 'id') $ordersql = "  ORDER BY arc.id $orderWay";
    else if($orderby == 'near') $ordersql = " ORDER BY ABS(arc.id - ".$arcid.")";
    else if($orderby == 'lastpost') $ordersql = "  ORDER BY arc.lastpost $orderWay";
    else if($orderby == 'scores') $ordersql = "  ORDER BY arc.scores $orderWay";
    //功能:增加按好评数和差评数调用
    else if($orderby == 'goodpost') $ordersql = " order by arc.goodpost $orderWay";
    else if($orderby == 'badpost') $ordersql = " order by arc.badpost $orderWay";
    else if($orderby == 'rand') $ordersql = "  ORDER BY rand()";
    else $ordersql = " ORDER BY arc.sortrank $orderWay";

改为

    //文档排序的方式
    $ordersql = '';
    if($orderby=='hot' || $orderby=='click') $ordersql = " ORDER BY arc.click $orderWay";
    else if($orderby == 'sortrank' || $orderby=='pubdate') $ordersql = " ORDER BY arc.sortrank $orderWay";
    else if($orderby == 'id') $ordersql = " ORDER BY arc.id $orderWay";
    else if($orderby == 'near') $ordersql = " ORDER BY ABS(arc.id - ".$arcid.")";
    else if($orderby == 'lastpost') $ordersql = " ORDER BY arc.lastpost $orderWay";
    else if($orderby == 'scores') $ordersql = " ORDER BY arc.scores $orderWay";
    else if($orderby == 'rand') $ordersql = " ORDER BY rand()";
    else if($orderby == 'weight') $ordersql = " order by arc.weight asc";//如果没有特定设置排序则按照权重先排序
    else $ordersql = " ORDER BY arc.sortrank $orderWay";

然后我们就可以在首页使用orderby='weight’进行排序了

转载声明:本站发布文章及版权归原作者所有,转载本站文章请注明文章来源!

网友评论

复制成功
微信号: gaogaojie5
添加微信好友, 获取更多信息
我知道了
添加微信
微信号: gaogaojie5
添加微信好友, 获取更多信息
一键复制加过了