Home> CMS Tutorial> DEDECMS> body text

How to make DEDECMS list tag support weight sorting

藏色散人
Release: 2020-01-08 09:05:08
Original
2051 people have browsed it

How to make DEDECMS list tag support weight sorting

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}
Copy after login
Copy after login

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}
Copy after login

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"; }
Copy after login

3. Continue to look for the "if(ereg('hot|click|lastpost',$orderby))" statement and modify it to:

if(ereg('hot|click|weight|lastpost',$orderby))
Copy after login

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}
Copy after login
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!