How to make the list tag of DEDECMS support weight sorting?
How to make the list tag of DEDECMS support weight Sorting
Recommended learning:梦Weavercms
DEDECMS system supports document weight sorting, which can be used in templates:
{dede:arclist row='10' titlelen='50' orderby='weight'} •[field:textlink/]
{/dede:arclist}
where The orderby='weight' realizes the ordering of documents according to weight. This is the arclist tag, which can be used anywhere to call the document list.
However, on the column list page, if you want to use the list tag (to implement paging of the document list), you also want to sort by weight,
{dede:list pagesize='10' titlelen='50' orderby='weight'} •[field:textlink/]
{/dede:list}
You will find that your list is not sorted by weight. No matter how you modify it, its order will remain the same!
Reason: dedecms only supports arclist tags for weight sorting, and does not support list tags
Solution:
1. Open the file arc.listview.class.php
2. Find the "else if($orderby=="lastpost") {" statement, which is probably at line 609. Press the Enter key in front of this line and insert the following statement:
else if($orderby=="weight") { $ordersql = " order by arc.weight $orderWay"; }
3. Continue to look for the "if(ereg('hot|click|lastpost',$orderby))" statement and modify it to:
if(ereg('hot|click|weight|lastpost',$orderby))
After the modification is completed, save it. If weight sorting has been used in the target, After generating it, you can see that the document list has been sorted by weight
4. Template call
{dede:arclist row='10' titlelen='50' orderby='weight'} •[field:textlink/]
{/dede:arclist}
The above is the detailed content of How to make DEDECMS list tag support weight sorting. For more information, please follow other related articles on the PHP Chinese website!