function GetOneImgUrl($img,$ftype=1){if($img <> ''){$dtp = new DedeTagParse();$dtp->LoadSource($img);if(is_array($dtp->CTags)){foreach($dtp->CTags as $ctag){if($ctag->GetName()=='img'){$width = $ctag->GetAtt('width');$height = $ctag->GetAtt('height');$imgurl = trim($ctag->GetInnerText());$img = '';if($imgurl != ''){if($ftype==1){$img .= $imgurl;}else{$img .= '<img src="'.$imgurl.'" width="'.$width.'" height="'.$height.'" />';}} }}}$dtp->Clear();return $img;}}
{dede:arclist addfields='pro_img1,pro_img2' channelid='1' }<img src="[field:pro_img1 function='GetOneImgUrl(@me,1)'/]" width="100" height="100" /><a href="[field:pro_img2 function='GetOneImgUrl(@me,1)'/]"><img src="[field:pro_img2function='GetOneImgUrl(@me,1)'/]" width="100" height="100" /></a>{/dede:arclist}
{dede:arclist addfields='pro_img1' channelid='1' } <img src="[field:pro_img1 runphp='yes'] $ndtp = new DedeTagParse(); $ndtp->LoadSource(@me); $ntag = $ndtp->GetTag("img"); @me = trim($ntag->GetInnerText()); [/field:pro_img1]" width="100" height="100" />{/dede:arclist}
新闻热点
疑难解答