


What should I do if the order of phpcms related articles remains unchanged?
#What should I do if the sorting of phpcms remains unchanged?
How to modify the problem of unchanged sorting of phpcms related articles:
Open phpcms/modules/content/classes/content_tag.class.php content model tag class , it is found that this tag will be sorted according to the order parameter only when the content has artificially set related readings. When the content does not have artificially set related readings, the query is performed based on keywords, but at this time, the order parameter is not sorted. Instead, it is not sorted. This is why the related readings called by articles are always so old.
The method to correct this problem is as follows:
Modify the phpcms/modules/content/classes/content_tag.class.php content model tag class file, and modify the relation method in the content_tag class to :
The code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
In fact, it is just $r = $this->db->select($sql2, '*', $limit, '','', 'id'); replaced by $r = $this->db->select($sql2, '*', $limit, $order,'','id'); and let the order parameter be passed into the query method.
In the template, use the following tags and add the order parameter to achieve sorting.
The code is as follows:
1 2 3 4 |
|
If you are a mysophobic friend and are worried that directly modifying the PC will affect future upgrades, you can extract it separately. Put it in the template and use it as a function. The code is as follows:
The code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
In the template, use the following PHP code to obtain it.
The code is as follows:
1 2 3 |
|
In fact, it is just a small problem. The PC should be corrected in the future. The above method is provided to those anxious webmaster friends.
Recommended tutorial: "PHP Video Tutorial"
The above is the detailed content of What should I do if the order of phpcms related articles remains unchanged?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
