GetAtt('weight')"; then modify the document sorting method; finally Save this file to sort the home page by weight.">
DEDE 5.7 How to sort the homepage by weight?
DEDE 5.7 Homepage [arclist] Add by weight Sorting
1. Find the arclist.lib.php file in the following directory \include\taglib in the DreamWeaver system and open it
Found around lines 74 and 75:
Recommended learning:dedecms tutorial
// arclist是否需要weight排序,默认为"N",如果需要排序则设置为"Y" $isweight = $ctag->GetAtt('isweight');
Modify this line to:
$weight = $ctag->GetAtt('weight');
Found around line 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";
and modify it to:
//文档排序的方式 $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 Now save this document, we can use orderby='weight' to sort on the home page.
The above is the detailed content of How to sort DEDE 5.7 home page by weight. For more information, please follow other related articles on the PHP Chinese website!