Solution to invalid weight sorting by Zhimeng cms _ PHP Tutorial

Source: Internet
Author: User
Tags ereg
Weimeng cms uses weight sorting to solve the problem. Dedecms5.7 has a bug in weight sorting. next I will show you how to solve weight's invalid solution step by step. for details, refer to the following. The files involved are includetaglibarclist. l dedecms5.7. there is a bug in weight sorting. Next, I will show you how to solve the weight invalid solution step by step. for details, refer to the following.

The file involved is the includetaglibarclist. lib. php file:

About 570th rows:

The code is as follows:
If ($ isweight = 'y ')

This line of code is useless, $ orderWeight = list_sort_by ($ orderWeight, 'weight', 'asc '); sorts the results.

This is problematic, because the statement for retrieving the document table before getting this $ orderWeight is:

The code is as follows:

SELECT arc. *, tp. typedir, tp. typename, tp. corank, tp. isdefault, tp. defaultname, tp. namerule,

Tp. namerule2, tp. ispart, tp. moresite, tp. siteurl, tp. sitepath
FROM 'dede _ archives 'Arc left join 'dede _ arctype 'tp ON arc. typeid = tp. id WHERE arc. typeid IN (29) AND

Arc. arcrank>-1 order by arc. sortrank DESC

Obviously, when we write tags, we write

The code is as follows:

{Dede: arclist orderby = 'weight' typeid = '29' isweight = 'y'

Limit = '4, 1' titlelen = '000000' infolen = '000000 ′}

The intention is to sort the data by weight.

For the database retrieved by sortrank, the specified isweight = 'y' only starts to sort the retrieved dataset according to weight.


Therefore, the solution is very simple: add a weight-ordered processing statement at the 330 rows of the program file:

The code is as follows:

Else if ($ orderby =

'Weight') $ ordersql = "order by arc. weight asc ";

Let's separate a list tag to support weight sorting.

The code is as follows:

{Dede: list pagesize = '10' titlelen = '50' orderby = 'weight'} • [field: textlink/]
{/Dede: list}

Method:

1. open the arc. listview. class. php file.

2. find the "else if ($ orderby =" lastpost ") {" statement, which is about 609 rows. press enter before this line to insert the following statement:

The code is as follows:

Else if ($ orderby = "weight") {$ ordersql = "order by arc. weight $ orderWay ";}

3. continue to find the "if (ereg ('hot | click | lastpost', $ orderby)" statement and change it:

The code is as follows:

If (ereg ('hot | click | weight | lastpost', $ orderby ))

Save the modification. if weight sorting has been used in the target, generate it and you will see that weight sorting has been installed in the document list.

4. template call

The code is as follows:

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

Bytes. The file involved is includetaglibarclist. l...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.