打开/include/common.func.php文件
在最底部加入函数:
// 在图集列表中调出图集的所有图片function Getimgs($aid, $imgwith = 220, $imgheight = 80, $num = 0, $style = ''){global $dsql;$imgurls = '';$row = $dsql -> getone("Select * From`dede_addonimages` where aid='$aid'"); //$imgurls = $row['imgurls'];preg_match_all("/{dede:img (.*)}(.*){\/dede:img/isU", $imgurls, $wordcount);$count = count($wordcount[2]);if ($num > $count || $num == 0){$num = $count;}for($i = 0;$i < $num;$i++){if($style == 'li'){$imglist .= "<li><a href=https://www.91084.com/" . $i . "><imgsrc=". trim($wordcount[2][$i]) . " width=" . $imgwith . " height=" . $imgheight . "></a></li>";}else{$imglist .= "<li><img class='lazy' src='../images/grey.gif' data-original=". trim($wordcount[2][$i])." width=" . $imgwith . " height=" . $imgheight . "></li>";//此处用到了jquery的loadlazy延时加载插件。}}return $imglist;}
- 前端调用
{dede:arclist row='6'} // row=3 调用六个图集[field:id function="Getimgs(@me,136,62,4)" /] //每个图集调用前4张{/dede:arclist}