Home  >  Article  >  CMS Tutorial  >  How to sort in descending order in phpcms

How to sort in descending order in phpcms

藏色散人
藏色散人Original
2020-07-21 09:11:222277browse

How to implement descending order of phpcms: first find and open the "formguide_fields.class.php" file; then find the "listview" method part in the file; then add the statement "order by dataid desc" in the corresponding position of the code ;Save at last.

How to sort in descending order in phpcms

phpcms form information is arranged in reverse order (arranged in descending order by ID) code modification!

I was really drunk and searched for a long time, but I still found the list function from paging. The phpcms form information is arranged in reverse order (in descending order by ID) and the code is modified.

In formguide\admin\include \formguide_fields.class.php, find:

function listview($page = 1, $pagesize = 30) 
{ 
$page = max(intval($page), 1); 
$offset = $pagesize*($page-1); 
$limit = " LIMIT $offset, $pagesize"; //phpfensi.com 
$result = $this->db->query("SELECT * FROM $this->tablename $limit");

Add "order by dataid desc" (note the space) desc before "$limit" in "SELECT * FROM $this->tablename $limit" Descend means descending order asc means ascend ascending order.

Recommended: "phpcms tutorial"

The above is the detailed content of How to sort in descending order in phpcms. 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