Home > Article > CMS Tutorial > 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: The sorting of the tag dede:arclist is specified by orderby, as follows:{dede:arclist orderby='排序字段' } {/dede:arclist}
orderby='sortrank' 文档排序方式 § orderby='hot' 或 orderby='click' 表示按点击数排列 § orderby='sortrank' 或 orderby='pubdate' 按出版时间排列 § orderby='near' § orderby=='lastpost' 按最后评论时间 § orderby=='scores' 按得分排序 § orderby='id' 按文章ID排序 § orderby='rand' 随机获得指定条件的文档列表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/]
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!