織夢(mèng)列表頁(yè)list標(biāo)簽weight權(quán)重排序方法
來源:本站原創(chuàng)
|時(shí)間:2021-08-05
|欄目:
dedecms|點(diǎn)擊: 次
織夢(mèng)列表頁(yè)list標(biāo)簽weight權(quán)重排序方法:(注:紅色標(biāo)記部分就是修改處)
1、打開include/arc.listview.class.php
2、找到
else if($orderby=="lastpost") {
$ordersql = " ORDER BY arc.lastpost $orderWay";
}
|
替換
else if($orderby=="lastpost") {
$ordersql = " ORDER BY arc.lastpost $orderWay";
}
else if($orderby=="weight") {
$ordersql = " ORDER BY arc.weight $orderWay";
}
|
3、找到
//如果不用默認(rèn)的sortrank或id排序,使用聯(lián)合查詢(數(shù)據(jù)量大時(shí)非常緩慢)
if(preg_match('/hot|click|lastpost/', $orderby))
|
替換
//如果不用默認(rèn)的sortrank或id排序,使用聯(lián)合查詢(數(shù)據(jù)量大時(shí)非常緩慢)
if(preg_match('/hot|click|lastpost|weight/', $orderby))
|
4、找到
$query = "SELECT id FROM `dede_arctiny` arc WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row ";
|
替換
$query = "SELECT id FROM `dede_archives` arc WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row ";
|
5、標(biāo)簽調(diào)用:
{dede:list orderby='weight' pagesize ='3'}
{/dede:list}
|
接下來{dede:list}標(biāo)簽就支持了按權(quán)重排序的調(diào)用了。