Copyright @ 2015-2024 织梦园 版权所有 Power by DedeCms
鲁ICP备15039853号-2

模板标签 TAG标签 网站地图 XML地图 今日更新 返回顶部
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}
|