ҳԶбóͼƬֶβȷͼƬַ?Ҫ⣬DZôһԶ庯Ǿϸ˵

һʵַ1Զ庯
/include/extend.func.php ļעļϵͳԤԶ庯ӿļҪڶοõġϰ汾ĬûļԼһPHPļɣ?>һмº룺
/****************
function GetOneImgUrl
@@ ܣȡԶֶͼƬַ
*****************/
    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;
        }
    }
ƴ
رռɡ
2÷       ʣǴúԺôҪأ
𣺱ĵ÷Ϊ
[field:ԶͼƬֶ function='GetOneImgUrl(@me,ʾ)'/]
磺ǵԶͼƬֶΪ imgurl ô÷ʽ֣
[field:imgurl function='GetOneImgUrl(@me,0)'/] <!CͼƬϢԶÿȺ͸߶ȣѰHtml<img />ǩC>
[field:imgurl function='GetOneImgUrl(@me,1)'/] <!CֻͼƬַһڱͼǶרC>


ʾʾ
1ģֶ       վ̨[][ģ͹]ͨ''ġ''ť༭棬лֶι''ѡֶ''
ֶԺӻ༭ĵʱôͻֶˡ
ϴҪʾͼƬԺ󣬱漴ɡ
2ǰ̨       ԭǰֶ̨εķͨarclistǩ channelid addfields ϵãﲻظһһԶֶεķģ
{dede:arclist row='2 channeld='1 addfields='Զֶ1,Զֶ2}
ײģ insertext
{/dede:arclist}
õǸղŵ÷Ϊ
{dede:arclist row='5 orderby='id' channelid='1 addfields='imgurl'}
<li>[field:title/][field:imgurl function='GetOneImgUrl(@me,0)'/]</li>
{/dede:arclist}

(0)
(0)