按照 标题的id 降序排列。
这个效果需要修改2 个php文件。
第一步骤:
1. 修改 includetaglibchannelspecialtopic.lib.php 文件
2. 在第52行 处 有这行代码:
$ctag->GetAtt('imgwidth'), $ctag->GetAtt('imgheight'), 'all', 'default', $keywords, $listTemplet, 0, $idlist,
修改成:
$ctag->GetAtt('imgwidth'), $ctag->GetAtt('imgheight'), 'all', 'asc', $keywords, $listTemplet, 0, $idlist,
3. 保存文件结束
第二步骤:
1.修改includetaglibarclist.lib.php
2. 大约在196行处。有这行代码:
//文档排序的方式
$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 == 'asc') $ordersql = " order by arc.id asc";
//增加 结束
else $ordersql = " order by arc.sortrank $orderWay";
3. 修改结束
下面再给一个实现方法
1、找到 include/taglib//channel/specialtopic.lib.php
2、将 require_once(DEDEINC.'/taglib/arclist.lib.php'); 换成 require_once(DEDEINC.'/taglib/arclist.lib2.php');
3、复制arclist.lib.php 改名成 arclist.lib2.php
然后修改arclist.lib2.php
查找$order='desc' 替换成 $orderby='id'
仿站关于是升序还是降序排列只需要
查找$orderWay = AttDef($order,'desc'); 替换成 $orderWay = AttDef($order,'asc');
想调用以下参数,只需要按着修改就行
§ orderby='hot' 或 orderby='click' 表示按点击数排列
§ orderby='sortrank' 或 orderby='pubdate' 按出版时间排列
§ orderby='near'
§ orderby=='lastpost' 按最后评论时间
§ orderby=='scores' 按得分排序
§ orderby='id' 按文章ID排序
§ orderby='rand' 随机获得指定条件的文档列表
对于dedecms 5.1的版本
id排序增加功能更
include/inc/.inc_fun_SpFullList.php
//文档排序的方式
$ordersql = "";
if($orderby=='rand') $ordersql = " order by rand()";
else if($orderby=='click'||$orderby=='hot') $ordersql = " order by arcf.click desc";
else if($orderby=='digg') $ordersql = " order by arcf.digg desc";
else if($orderby=='diggtime') $ordersql = " order by arcf.diggtime desc";
else $ordersql=" order by arcf.aid desc";
// 2013年针对专题id列表所加功能
if($idlist!=''){
$ordersql = " order by find_in_set(arcf.aid,'$idlist')";
}
如果本文对你有帮助,欢迎打赏本站