dedecms修改,让likearticle标签支持limit属性

网站根目录下include\taglib找到likearticle.lib.php找到

$attlist="row|12,titlelen|28,infolen|150,col|1,tablewidth|100,mytypeid|0,byabs|0,imgwidth|120,imgheight|90";

替换成

$attlist="row|12,titlelen|28,infolen|150,col|1,tablewidth|100,mytypeid|0,byabs|0,imgwidth|120,imgheight|90,limit|0";

$colWidth = $colWidth."%";

行下增加

if($limit!=0){

$limits='limit '.$limit;

}else{

$limits='limit 0';

}

接下来就是要修改sql语句找到

$query变量

$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

FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id

where arc.arcrank>-1 AND ($keyword)$typeid $orderquery limit 0, $row";

修改为

$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

FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id

where arc.arcrank>-1 AND ($keyword)$typeid $orderquery $limits, $row";

找到

$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

FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id

WHERE arc.arcrank>-1 AND$typeid $orderquery limit 0, $row";

修改为

$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

FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id

WHERE arc.arcrank>-1 AND$typeid $orderquery $limits, $row";

点击保存然后清除dede缓存

前台内容页调用标签为

{dede:likearticle row='5' col='1' }

[[field:title/]](https://link.jianshu.com?t=http://blog.sina.com.cn/s/%5Bfield:arcurl/%5D)[field:pubdate function="MyDate('m.d',@me)"/]

{/dede:likearticle}

{dede:likearticle row='5' col='1' limit='5'}

[[field:title/]](https://link.jianshu.com?t=http://blog.sina.com.cn/s/%5Bfield:arcurl/%5D)[field:pubdate function="MyDate('m.d',@me)"/]

{/dede:likearticle}

你可能感兴趣的:(dedecms修改,让likearticle标签支持limit属性)