Home  >  Article  >  CMS Tutorial  >  How to make the list tag of DEDECMS support weight sorting

How to make the list tag of DEDECMS support weight sorting

藏色散人
藏色散人Original
2019-12-02 09:17:272334browse

How to make the list tag of DEDECMS support weight sorting

How to make the list tag of DEDECMS support weight sorting?

DEDECMS system supports document weight sorting, which can be used in templates:

{dede:arclist row='10' titlelen='50' orderby='weight'} •[field:textlink/]
{/dede:arclist}

The orderby='weight' realizes the sorting 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 installed with weight sorting

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 the list tag of DEDECMS support weight sorting. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn