打开 \include\extend.func.php 在最下面加入这个方法
01 function Getimgurls($aid,$num=4) 02 { 03 global $dsql; 04 $imgurls = $result = ''; 05 $imgrow = $dsql->GetOne( "Select imgurls From `mydiy_addonimages` where aid='$aid' "); 06 $imgurls = $imgrow['imgurls']; 07 if($imgurls != '') 08 { 09 $dtp = new DedeTagParse(); 10 $dtp->LoadSource($imgurls); 11 $images = array(); 12 if(is_array($dtp->CTags)) 13 { 14 foreach($dtp->CTags as $ctag) 15 { 16 if($ctag->GetName() == 'img') 17 { 18 $row = array(); 19 $row['width'] = $ctag->GetAtt('width'); 20 $row['height'] = $ctag->GetAtt('height'); 21 $row['imgsrc'] = trim($ctag->GetInnerText()); 22 $row['text'] = $ctag->GetAtt('text'); 23 $images[] = $row; 24 } 25 } 26 } 27 $dtp->Clear(); 28 $i = 0; 29 foreach($images as $row) 30 { 31 if($i == $num) break; 32 if($row['imgsrc'] != '') 33 { 34 $result .= "1
1 [field:id function=Getimgurls(@me,3)/] 3表示,此篇图集调用三张图片。
标签: