當前位置:首頁 > 常見問題 > 正文 】【打印

DEDE 5.7 dede:list orderby=weight 按權重排序無效問題

http://www.785582.tw  2016年10月19日

關于dede織夢系統list按照權重排序無效的問題,重新歸納了如下:

1、修改arc.listview.class.php文件:

找到list解析文件include/arc.listview.class.PHP

發現排序規則里面并沒有按照weight排序的判斷,于是乎修改程序加入排序規則
//排序方式
$ordersql = '';
if($orderby=="senddate" || $orderby=="id") {
$ordersql=" order by arc.id $orderWay";
}
else if($orderby=="hot" || $orderby=="click") {
$ordersql = " order by arc.click $orderWay";
}
else if($orderby=="lastpost") {
$ordersql = "  order by arc.lastpost $orderWay";
}
else if($orderby=="weight") {
$ordersql = "  order by arc.weight $orderWay";
}
else {
$ordersql=" order by arc.sortrank $orderWay";
}

同時修改條件if(ereg('hot|click|lastpost',$orderby))為if(ereg('hot|click|lastpost|weight',$orderby)), [搜索 hot|click|lastpost 定位]

2、修改arclist.lib.php文件:

在織夢系統中找到以下目錄\include\taglib中的arclist.lib.php文件并打開

//文檔排序的方式
$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 if($orderby == 'weight') $ordersql = "  order by arc.weight desc";
else $ordersql = " ORDER BY arc.sortrank $orderWay";


// arclist是否需要weight排序,默認為"N",如果需要排序則設置為"Y"


$isweight = $ctag->GetAtt('isweight');
把這行修改為:
$weight = $ctag->GetAtt('weight');


3、模板頁面調用:

arclist 對weight的排序也不準確,需要加上一個isweight的屬性

{dede:arclist typeid='32' pagesize='20' isweight='Y' orderby='weight' orderway='desc'}



作者:五天網絡 來源:重慶網站建設
上一條: 阿里云服務器云盾檢測 /include/ 下一條:64位服務器IIS提示未找到提供程序 該


(閱讀次數:1544次) 【 】【關閉】【打印返回頂部↑

山东齐鲁风采福利彩票