Home > CMS Tutorial > DEDECMS > body text

How to implement dede:arclist tag sorting

藏色散人
Release: 2019-12-25 09:42:47
Original
1784 people have browsed it

How to implement dede:arclist tag sorting

##dede: How to implement arclist tag sorting?

Tag dede: The sorting of arclist is specified by orderby. The specific implementation is as follows. Friends in need can refer to it

Recommended learning:

梦Weavercms

The sorting of the tag dede:arclist is specified by orderby, as follows:

{dede:arclist orderby='排序字段' } 
{/dede:arclist}
Copy after login
orderby='sortrank' 文档排序方式 
§ orderby='hot' 或 orderby='click' 表示按点击数排列 
§ orderby='sortrank' 或 orderby='pubdate' 按出版时间排列 
§ orderby='near' 
§ orderby=='lastpost' 按最后评论时间 
§ orderby=='scores' 按得分排序 
§ orderby='id' 按文章ID排序 
§ orderby='rand' 随机获得指定条件的文档列表
Copy after login

The only values ​​that can be assigned to orderby are the values ​​listed above, that is to say, the dede:arclist tag You can only sort by the fields listed above.

How can I sort by custom fields? If I now add a field NewField to the dede_archives table,

I want to sort according to this field. Writing it directly like this: {dede:arclist orderby='NewField'} will not work. How should it be modified?

Modify the file include/arc.listview.class.php, refer to the attachment arc.listview.class.php (version 5.5utf8), and modify it as follows:

At lines 560 to 562 Add the following code:

else if($orderby=="NewField") { 
$ordersql = " order by arc.NewField $orderWay"; 
[field:global name=autoindex/]
Copy after login

The above is the detailed content of How to implement dede:arclist tag 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
Popular Tutorials
More>
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!