我们都知道织梦的图集默认调用语法是:{dede:field name='imgurls' src="https://www.baidu.com/uploads/allimg/180903/1-1PZ3150P70-L.jpg"/> 今天,AB模板网就教大家如何在织梦的图集中调用当前文档的所有图片及注释。 打开/include/common.func.php,在最后面加上以下代码: //循环输出图集全部图片及注释 function Getimgs($aid, $imgwith, $imgheight, $num){ global $dsql; $imgurls = ''; $row = $dsql -> getone("Select * From`aier_addonimages` where aid='$aid'"); // $imgurls = $row['imgurls',; preg_match_all("/{dede:img (.*)}(.*){/dede:img/isU", $imgurls, $wordcount); $textinfo = $wordcount[1,; $count = count($wordcount[2,); if ($num > $count || $num == 0){$num = $count;} for($i = 0;$i $textinfoe = $textinfo[$i,; $textinfoee = explode(" ",$textinfoe); $imglist .= ""." [img]".trim($wordcount[2,[$i,)."[/img] ".""."".substr($textinfoee[1,,6,-1).""."".""; } return $imglist; } 在首页调用语法: {dede:arclist typeid=''} [field:id function="Getimgs(@me,80]70]7)"/] {/dede:arclist, 在列表页调用语法: {dede:list} [field...
内容已隐藏,请关注公众号输入验证码查看
本帖支持关注公众号查看
【无套路 无套路 无套路 扫描二维码关注公众号发送【验证码】收到验证码 在上面输入点击提交查看即可显示隐藏内容】
|