打开 include/extend.func.php 在最下面加入这个方法 function Getimgurls($aid,$num=3) { global $dsql; $imgurls = $result = ''; $imgrow = $dsql->GetOne( "Select imgurls From `dede_addonimages` where aid='$aid' "); $imgurls = $imgrow['imgurls',; if($imgurls != '') { $dtp = new DedeTagParse(); $dtp->LoadSource($imgurls); $images = array(); if(is_array($dtp->CTags)) { foreach($dtp->CTags as $ctag) { if($ctag->GetName() == 'img') { $row = array(); $row['width', = $ctag->GetAtt('width'); $row['height', = $ctag->GetAtt('height'); $row['imgsrc', = trim($ctag->GetInnerText()); $row['text', = $ctag->GetAtt('text'); $images[, = $row; } } } $dtp->Clear(); $i = 0; foreach($images as $row) { if($i == $num) break; if($row['imgsrc', != '') { $result .= "[*,[url={$row[, [img]{$row[[/img] [/url]"; } $i++; } return $result; } } 请注意 [*,[url={$row[, [img]{$row[[/img] [/url] 上面这段代码改成符合自己页面的html格式。 前台模板中调用代码如下: [field:id function=Getimgurls(@me,3)/] 3表示,此篇图集调用三张图片。...
内容已隐藏,请关注公众号输入验证码查看
本帖支持关注公众号查看
【无套路 无套路 无套路 扫描二维码关注公众号发送【验证码】收到验证码 在上面输入点击提交查看即可显示隐藏内容】
|