我们都知道织梦的{dede:likearticle}没有orderby这个功能,我们需要让它支持orderby要怎么操作呢?
下面是修改方法
打开/include/taglib/likearticle.lib.php文件
找到
if( empty($arcid) || $byabs==0 ) {
$orderqZ * l t Puery = " order by arc.id desc ";
}
else {
$orderquery = " order by ABS(arc.id – ".$arcid.") ";
}
改成:
if($orderby=='hot' || $orderby=='click') $orderquery = " order by a9 y ? # / -rc.click $orderWay"; else if($orderby == 'sortrank' || $orderby=g B i ( & p + \='pubdate') $orderquery = " orderby arc.sortrank $orderWay"; else if($o] E :rderby == 'id') $orderquery = " order by arc.* % | Q t D 1 ? Pid $orderWay"; else if($orderby == 'near') $orderquery = " order by ABS(arc.id – ".$arcid.")"; else if($orderbyn / V V == 'lastpost') $orderquery = " order by arc.lastpost $orderWay"; else if($orderby == 'scores') $orderquery = " order by arc.scores $or@ Y e nderWay"; else if($orderby ==~ E B m Q $ _ 'randq P [ B A _') $om . ^ - s l 5 !rderquery = " orderW } ) % r by rand()"; else if($orderby == 'weight') $orderquery = " order! O O by arc.weight asc";//如果没有特定设置排序则按照权重先排序 else $orderquery = " order by arc.sortrank $orderWay";