织梦cms这表标签有自带的col参数可以分为两列或者几列,但是调用起来及其不方便,标签自带的是tr的方式,但是无法灵活运用到自己的模板中,我想用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";
点击保存。
前台内容页调用标签为:
<ul class="width318 grade-xinxi top-z fl-left margin01">{dede:likearticle row="5" orderby="rand" titlelen="50" } <li> <a href="[field:arcurl /]" title="[field:title /]">[field:title /]</a> </li> {/dede:likearticle}</ul><ul class="width318 grade-xinxi top-z fl-right margin02">{dede:likearticle row="5" orderby="rand" titlelen="50" limit="5"} <li> <a href="[field:arcurl /]" title="[field:title /]">[field:title /]</a> </li> {/dede:likearticle}</ul>
新闻热点
疑难解答