让织梦likearticle标签支持orderby的办法

炎热的夏天过去了,凉爽的秋天来了。它是一个收获的季节,也是各种水果最多的时候,红艳艳的苹果扒开绿叶往外瞧;小红灯笼似的枣子挂满枝头;像紫玛瑙的葡萄一串串地挂在葡萄架下,真迷人呀!
我们都知道织梦的{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";

本文让织梦likearticle标签支持orderby的办法到此结束。成功都永远不会言弃,放弃者永远不会成功。小编再次感谢大家对我们的支持!