dedecms專題內容頁{dede:field.note /}節點排序默認是按照更新時間降序排列的,我現在想讓它升序排列,該怎么修改呢,請看下文:
1、{dede:field.note}其實是用{dede:arclist}{/dede:arclist}標簽里的lib_arclistDone來解析的,從{dede:arclist}標簽的參數可以獲知,和排序相關的是orderby和order,orderby是文檔排序方式,order是降序還是升序,也就是desc還是asc,理解了這里就能進行下邊的操作了。
2、打開dede/spec_add.php和dede/spec_edit.php,分別找到:
$notelist .= "{dede:specnote imgheight=\\'$imgheight\\' imgwidth=\\'$imgwidth\\'
infolen=\\'$infolen\\' titlelen=\\'$titlelen\\' col=\\'$col\\' idlist=\\'$okids\\'
name=\\'$notename\\' noteid=\\'$noteid\\' isauto=\&;$isauto\&; rownum=\\'$rownum\\'
keywords=\\'$keywords\\' typeid=\\'$typeid\\'}
2個文件里邊的這段內容都是相同的,在
typeid=\\'$typeid\\'
后邊加入
order=\\'asc\\'
order前邊有個空格噢,別忘了。
這步實現的是添加和修改專題的時候在底層模板里加入排序的2個字段。
order值為asc或者desc
3、打開include/taglib/channel/specialtopic.lib.php,找到
$ctag->GetAtt('att')
在其后邊加入
,$ctag->GetAtt('order')
4、找到specialtopic.lib.php第51行中的default改為id即可。
到這里就大功告成了。
注意:已經發布的專題需要修改,保存后才能生效。本文在dedecms5.7SP1下成功調用,其他版本未作測試。