POST TIME:2017-10-27 22:18
先上調用標簽 {dede:channel type='top' row='8' limit='0,1' currentstyle="<li><ahref='~typelink~'class='thisclass'>~typename~</a></li>"}<li><ahref='[field:typelink/]'>[field:typename/]</a></li>{/dede:channel}相比默認的標簽只是多了一個limit='0,1'屬性,其效果就是調用0位置起始1條數據。 打開include\taglib\channel.lib.php,找到 $attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|,cacheid|";修改為$attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|,cacheid|,limit|";然后在 $line=empty($row)?100:$row;之后添加 //limit條件$limit=trim(preg_replace('#limit#is','',$limit));if($limit!=''){$limitsql=" LIMIT $limit ";}else{$limitsql=" LIMIT 0,$line ";}最后批量查找limit0,$line替換為 $limitsql至此完成。 |