打開/include/arc.listview.class.php,搜索
else {
$ordersql=" ORDER BY arc.sortrank $orderWay";
}
在它上面添加
else if($orderby=="goodpost") {
$ordersql = " ORDER BY arc.goodpost $orderWay";
}
繼續(xù)搜索
if(preg_match('/hot|click|lastpost/', $orderby))
替換成:
if(preg_match('/hot|click|lastpost|goodpost/', $orderby))
列表調(diào)用:
{dede:list pagesize='20' orderby='goodpost'}
同理,此方法也可實(shí)現(xiàn)按踩的數(shù)排序。
]]>功能說明:表示列表模板里的分頁內(nèi)容列表
適用范圍:僅列表模板 list_*.htm
基本語法:
{dede:list col='' titlelen='' infolen='' imgwidth='' imgheight='' listtype='' orderby='' pagesize='' orderway='' pagesize='20'}
<a href='[field:arcurl/]'>[field:title/]</a>
{/dede:list}
參數(shù)說明:
col='' 內(nèi)容列數(shù)
titlelen='' 標(biāo)題長度
infolen='' 內(nèi)容摘要長度
imgwidth='' 縮略圖寬
imgheight='' 縮略圖高
orderby='' 排序方式,有效的排序方式有 senddate、pubdate、id、click、lastpost、postnum ,默認(rèn)為 sortrank
pagesize='20' 分頁大小,調(diào)用文章條數(shù)
一般列表頁會(huì)增加一個(gè)分頁代碼{dede:pagelist istitem="index,pre,next,end,option,info," listsize="5"/}
演示效果如下:
功能說明:獲取指定文檔列表
適用范圍:全局使用
基本語法:
{dede:arclist? flag='h' typeid='' row='' col='' titlelen='' infolen='' imgwidth='' imgheight='' listtype='' orderby='' keyword='' limit='0,1'}
<a href='[field:arcurl/]'>[field:title/]</a>
{/dede:arclist}
參數(shù)說明:
col='' 分多少列顯示(默認(rèn)為單列),5.3版中本屬性可以通過多種方式進(jìn)行多行顯示,如果col='1'要多列顯示的可用div+css實(shí)現(xiàn)
以下為通過div+css實(shí)現(xiàn)多列的示例:
<style type=text/css>
div{width:400px;float:left;}
</style>
{dede:arclist row='10' titlelen='24' orderby='pubdate' idlist='' col='2'}
?[field:textlink/]([field:pubdate function=MyDate('m-d',@me)/])<br/>
{/dede:arclist}
演示效果如下
當(dāng)col>1將使用原來的table多列方式顯示
row='10' 返回文檔列表總數(shù)
typeid='' 欄目ID,在列表模板和檔案模板中一般不需要指定,在首頁模板中允許用","分開表示多個(gè)欄目;
getall='1' 在沒有指定這屬性的情況下,在欄目頁、文章頁模板,不會(huì)獲取以","分開的多個(gè)欄目的下級(jí)子類
titlelen = '30' 標(biāo)題長度 等同于titlelength
infolen='160' 表示內(nèi)容簡介長度 等同于infolength
imgwidth='120' 縮略圖寬度
imgheight='90' 縮略圖高度
listtype='all' 欄目類型 image含有縮略圖 commend推薦
orderby='sortrank' 文檔排序方式
§ orderby='hot' 或 orderby='click' 表示按點(diǎn)擊數(shù)排列
§ orderby='sortrank' 或 orderby='pubdate' 按出版時(shí)間排列
§ orderby='near'
§ orderby=='lastpost' 按最后評論時(shí)間
§ orderby=='scores' 按得分排序
§ orderby='id' 按文章ID排序
§ orderby='rand' 隨機(jī)獲得指定條件的文檔列表
keyword='' 含有指定關(guān)鍵字的文檔列表,多個(gè)關(guān)鍵字用","分
innertext = '' 單條記錄樣式
aid='' 指定文檔ID
idlist ='' 提取特定文檔(文檔ID)
channelid 頻道ID
limit='起始ID,記錄數(shù)'? (起始ID從0開始)表示限定的記錄范圍(如:limit='1,2'? 表示從ID為1的記錄開始,取2條記錄)
flag = 'h' 自定義屬性值:頭條[h]推薦[c]圖片[p]幻燈[f]滾動(dòng)[s]跳轉(zhuǎn)[j]圖文[a]加粗[b]
noflag = '' 同flag,但這里是表示不包含這些屬性
orderway='desc' 值為 desc 或 asc ,指定排序方式是降序還是順向排序,默認(rèn)為降序
subday='天數(shù)' 表示在多少天以內(nèi)的文檔