标签名称:likearticle
功能说明:自动关连文档标签
适用范围:内容页使用
基本语法:
{dede:likearticle row='' col='' titlelen='' infolen=''}
<a href='[field:arcurl/]'>[field:title/]</a>
{/dede:likearticle}
参数说明:
col=’’ 分多少列显示(默认为单列)
row=‘10’ 返回文档列表总数
titlelen = ‘30’ 标题长度 等同于titlelength
infolen=‘160’ 表示内容简介长度 等同于infolength
mytypeid=0 手工指定要限定的栏目id,用,分开表示多个
innertext = ‘’ 单条记录样式(指标签中间的内容)
底层模板字段:
ID(同 id),typeid, channel, arcrank, mid, click, title, fulltitle, textlink, info, filename, typeurl, stime,senddate, litpic(同picname)
默认情况下是不支持随机等排序,修改方法:
打开/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";
这样在使用orderby=rand之类的就会生效了!