我们都知道织梦的{dede:likearticle}没有orderby这个成果,我们需要让它支持orderby要怎么操纵呢?
下面是修改要领
打开/include/taglib/likearticle.lib.php文件
找到
if( empty($arcid) || $byabs==0 ) {
$orderquery = " order by arc.id desc ";
}
else {
$orderquery = " order by ABS(arc.id – ".$arcid.") ";
}
改成:
if($orderby=='hot' || $orderby=='click') $orderquery = " order by arc.click $orderWay";
else if($orderby == 'sortrank' || $orderby=='pubdate') $orderquery = " orderby arc.sortrank $orderWay";
else if($orderby == 'id') $orderquery = " order by arc.id $orderWay";
else if($orderby == 'near') $orderquery = " order by ABS(arc.id – ".$arcid.")";
else if($orderby == 'lastpost') $orderquery = " order by arc.lastpost $orderWay";
else if($orderby == 'scores') $orderquery = " order by arc.scores $orderWay";
else if($orderby == 'rand') $orderquery = " order by rand()";
else if($orderby == 'weight') $orderquery = " order by arc.weight asc";//假如没有特定配置排序则凭据权重先排序
else $orderquery = " order by arc.sortrank $orderWay";