关于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'}
作者:五天网络 来源:重庆网站建设 |