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}
|
版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!
转载请注明: 织梦dede模板下载自定义模型 数据类型图片调用教程