首頁  >  文章  >  CMS教程  >  DEDE 5.7 首頁怎麼依權重排序

DEDE 5.7 首頁怎麼依權重排序

藏色散人
藏色散人原創
2019-11-15 11:14:491885瀏覽

DEDE 5.7 首頁怎麼依權重排序

DEDE 5.7 首頁怎麼按權重排序?

DEDE 5.7 首頁【arclist】增加按權重排序

1、在織夢系統中找到以下目錄\include\taglib中的arclist.lib.php檔案並開啟

   大約在74 、75行找到:

推薦學習:dedecms教學

  // arclist是否需要weight排序,默认为"N",如果需要排序则设置为"Y"
$isweight = $ctag->GetAtt('isweight');

把這行修改為:

 $weight = $ctag->GetAtt('weight');

大約在327行找到

  //文档排序的方式
    $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 $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 $orderWay";//如果没有特定设置排序则按照权重先排序
    else $ordersql = " ORDER BY arc.sortrank $orderWay";

OK   現在保存這份文件了  我們就可以在首頁使用orderby='weight' 進行排序了。

以上是DEDE 5.7 首頁怎麼依權重排序的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn