Home CMS Tutorial DEDECMS How to sort the dedecms article list page by weight

How to sort the dedecms article list page by weight

Jul 20, 2019 pm 01:10 PM

How to sort the dedecms article list page by weight

When we want to sort the articles on the list page according to the rules we specify, we often need to modify the code ourselves to achieve it. If you just want to rank a certain article or a few articles at the front, you can first call one or several articles with recommended attributes in the code, and then call the articles without recommended attributes for the remaining content. By default, Just sort by time. But what should we do when we have a large number of articles that need to be ranked in a specified position? The best way is to set it to sort by weight. Let me share with you how to sort by weight on the dedecms article list page.

dede: How to sort the list by weight:

Find the "root directory\include\arc.listview.class.php" file.

How to sort the dedecms article list page by weight

Modify the code: Add the following judgment code sorted by weight at line 727 of the file:

How to sort the dedecms article list page by weight

and then at line 727 of the file Find this code if(preg_match('/hot|click|lastpost/', $orderby)) at line 778 and add the |weight/ part.

How to sort the dedecms article list page by weight

Tag call: {dede:list orderby='weight' orderway='asc'}, so that the {dede:list} tag implements the call sorted by weight.

How to sort the dedecms article list page by weight

dede: method of sorting arclist by weight:

How to sort the dedecms article list page by weight

in lines 74 and 75 Find the following code:

//Whether arclist needs to be sorted by weight, the default is "N", if sorting is required, set it to "Y" $isweight = $ctag->GetAtt('isweight');

Change this line to:

$weight = $ctag->GetAtt('weight');

How to sort the dedecms article list page by weight

Insert at line 327 The following line of code:

else if($orderby == 'weight') $ordersql = " order by arc.weight asc";

How to sort the dedecms article list page by weight

tag Call: {dede:arclist orderby='weight'}, so that the {dede:arclist} tag implements the call sorted by weight.

How to sort the dedecms article list page by weight

For more DedeCMS related technical articles, please visit the DedeCMS Tutorial column to learn!

The above is the detailed content of How to sort the dedecms article list page by weight. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)