$orderidlist = $ctag->GetAtt(‘orderidlist’);return lib_arclistDone($refObj, $ctag, $typeid, $ctag->GetAtt(‘row’), $ctag->GetAtt(‘col’), $titlelen, $infolen,$ctag->GetAtt(‘imgwidth’), $ctag->GetAtt(‘imgheight’), $listtype, $orderby,$ctag->GetAtt(‘keyword’), $innertext, $envs[‘aid’], $ctag->GetAtt(‘idlist’), $channelid,$ctag->GetAtt(‘limit’), $flag,$ctag->GetAtt(‘orderway’), $ctag->GetAtt(‘subday’), $ctag->GetAtt(‘noflag’),$tagid,$pagesize,$isweight,$orderidlist);2、找到function lib_arclistDone这段代码,在函数lib_arclistDone的最后加上参数$orderidlist=’N’,代码如下:
function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen=30, $infolen=160,$imgwidth=120, $imgheight=90, $listtype=’all’, $orderby=’default’, $keyword=”,$innertext=”, $arcid=0, $idlist=”, $channelid=0, $limit=”, $att=”, $order=’desc’, $subday=0, $noflag=”,$tagid=”, $pagesize=0, $isweight=’N’,$orderidlist=’N’)3、找到$innertext = trim($innertext); ,在其下面加上$orderidlist = AttDef($orderidlist,’N’);代码如下:
$orderby = strtolower($orderby);$keyword = trim($keyword);$innertext = trim($innertext);$orderidlist = AttDef($orderidlist,’N’);$tablewidth = $ctag->GetAtt(‘tablewidth’);$writer = $ctag->GetAtt(‘writer’);if($tablewidth == “”) $tablewidth = 100;4、搜索“//指定了id或使用缓存中的id” 把下面的条件语句改成:
//指定了id或使用缓存中的idif($idlist != ”){$query = “SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath$addfieldsSqlFROM `$maintable` arc left join `dede_arctype` tp on arc.typeid=tp.id$addfieldsSqlJoinWHERE arc.id in($idlist) “;if($orderidlist == ‘N’) {$query .= $ordersql;} else {$query .= ” ORDER BY FIELD(arc.id,$idlist) “;}}这样就对arclist添加了一个orderidlist属性,有参数Y/N, 默认为N,为Y的时候,就可以按idlist 排序了。其实这个原理也非常简单,就是利用的mysql数据库的ORDER BY FIELD功能。所以这样我们就可以使用idlist排序了
新闻热点
疑难解答