名站网址导航为大驾家提供DedeCMS站点程序站点教程相关的知识,比如织梦程序安装教程,织梦程序系统故障等教程。文章介绍
一、dedecms网站程序 v5.6站点列表页标签{dede:list}增加按权重排序标签
dedecms网站程序 v5.6版本已经中已经添加权重字段,并且在{dede:arclist}标签中默认可以使用。但在站点列表页的标签 {dede:list}中是还是无法按权重实现排序。其实解决相关具体操作方法很简单,下面给出相关具体操作方法:
1、打开\include\目录中的arc.listview.class.php网站文件,搜索“排序方式”,然后在
else if($orderby=="lastpost") {
$ordersql = " order by arc.lastpost $orderWay";
else if($orderby == "weight") {
$ordersql = " order by arc.weight asc";
}
else {
$ordersql=" order by arc.sortrank $orderWay";
}
这段相关具体代码如下中间添加以上红色相关具体代码如下。
4、向下找到if(ereg('hot|click|lastpost',$orderby))或者是if(preg_match('/hot|click|lastpost/', $orderby))修改成if(ereg('hot|click|lastpost|weight',$orderby))或者是if(preg_match('/hot|click|lastpost|weight/', $orderby)) ,保存网站文件。
这个时候在站点列表页里就可以使用{dede:list pagesize='5' orderby='weight'} 进行排序了。
二、DEDE 5.7 首页【arclist】增加按权重排序
1、在织梦程序系统中找到以下目录\include\taglib中的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站点程序站点教程相关的知识,就说到这里了希望能帮助朋友们。站点建设中用织梦程序做站点如何使arc支持也支持current