精品视频免费在线-精品视频一区二区-精品视频一区二区三区-精品视频一区二区三区免费-中文字幕97-中文字幕Aⅴ资源网

dede列表頁權重排序:
根據權重排序dede_arctiny 按weight實現文檔按權重weight排序(從小到大的順序)方法:
1,在list_artcile.htm模板中使用
{dede:list pagesize=’12′ orderby=’weight’ orderway=’asc’}
2,然后修改include目錄下的arc.listview.class.php
查找else if($orderby==”lastpost。。。
在下面補充
else if($orderby==”weight”) { $ordersql = ” order by arc.weight $orderWay”; }
3,同樣是這個文件,查找“if(ereg(‘hot|click|lastpost’,$orderby))”改為:
if(ereg(‘hot|click|weight|lastpost’,$orderby))

上面三個步驟,即可實現列表頁內容按權重排序,越小越靠前。

希望以上內容對大家有所幫助。

首頁按照權重排序:

1、在織夢系統中找到以下目錄includetaglib中的arclist.lib.php文件并打開

   大約在74 、75行找到:

      // arclist是否需要weight排序,默認為"N",如果需要排序則設置為"Y"
    $isweight = $ctag->GetAtt('isweight');

把這行修改為:

  $weight = $ctag->GetAtt('weight');

大約在327行找到

    //文檔排序的方式
    $ordersql = '';
    if($orderby=='hot' || $orderby=='click') $ordersql = " ORDER BY arc.click $orderWay";
    else if($orderby == 'sortrank' || $orderby=='pubdate') $ordersql = " ORDER BY arc.sortrank $orderWay";
    else if($orderby == 'id') $ordersql = "  ORDER BY arc.id $orderWay";
    else if($orderby == 'near') $ordersql = " ORDER BY ABS(arc.id - ".$arcid.")";
    else if($orderby == 'lastpost') $ordersql = "  ORDER BY arc.lastpost $orderWay";
    else if($orderby == 'scores') $ordersql = "  ORDER BY arc.scores $orderWay";
    else if($orderby == 'rand') $ordersql = "  ORDER BY rand()";
    else $ordersql = " ORDER BY arc.sortrank $orderWay";

修改為:

    //文檔排序的方式
    $ordersql = '';
    if($orderby=='hot' || $orderby=='click') $ordersql = " ORDER BY arc.click $orderWay";
    else if($orderby == 'sortrank' || $orderby=='pubdate') $ordersql = " ORDER BY arc.sortrank $orderWay";
    else if($orderby == 'id') $ordersql = "  ORDER BY arc.id $orderWay";
    else if($orderby == 'near') $ordersql = " ORDER BY ABS(arc.id - ".$arcid.")";
    else if($orderby == 'lastpost') $ordersql = "  ORDER BY arc.lastpost $orderWay";
    else if($orderby == 'scores') $ordersql = "  ORDER BY arc.scores $orderWay";
    else if($orderby == 'rand') $ordersql = "  ORDER BY rand()";
    else if($orderby == 'weight') $ordersql = "  order by arc.weight asc";//如果沒有特定設置排序則按照權重先排序
    else $ordersql = " ORDER BY arc.sortrank $orderWay";

OK   現在把這個文檔保存了  我們就可以在首頁使用 orderby='weight' 進行排序了。

備注:按照大還是小排序,如下修改:

織夢dedecms有一個按權重排序功能,不過是按權重越小越靠前來排序的。由于文章它默認權重跟ID相同,是越來越大的,所以有很多文章時,我們按照越小越靠前是很不合理的,所以我們要把它權重改成越大越靠前。

   方法:
    1. 在includetaglibarclist.lib.php文件中,將    else if($orderby == 'weight') $ordersql = "  order by arc.weight asc";//如果沒有特定設置排序則按照權重先排序

    2.改成   else if($orderby == 'weight') $ordersql = "  order by arc.weight desc";//如果沒有特定設置排序則按權重越大越靠前排序


 

轉發請注明:丁丁貓

猜你喜歡