dedecms文章列表页如何实现按权重排序
1、找到"根目录\include\arc.listview.class.php"文件。

2、修改代码:在文件第727行处添加如下按weight排序判断代码
else if($orderby=="weight") { $ordersql = " ORDER BY arc.weight $orderWay"; }

3、再在第778行处找到此段代码 if(preg_match('/hot|click|lastpost/', $orderby)) ,添加|weight/部分。

4、标签调用:{dede:list orderby='weight' orderway='asc'},这样{dede:list}标签就实现了按权重排序的调用。

1、在织梦系统中找到以下目录\include\taglib中的arclist.lib.php文件并打开

2、在74 、75行找到如下代码:
// arclist是否需要weight排序,默认为"N",如果需要排序则设置为"Y" $isweight = $ctag->GetAtt('isweight');
把这行修改为:
$weight = $ctag->GetAtt('weight');

3、在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";
插入下面这行代码:
else if($orderby == 'weight') $ordersql = " order by arc.weight asc";

4、标签调用:{dede:arclist orderby='weight'},这样{dede:arclist}标签就实现了按权重排序的调用。
