织梦列表页如何调用dede:img-DEDECMS

资源魔 36 0

织梦列表页若何挪用dede:img?

织梦列表页挪用dede:img

起首是网上的办法

1)创立自界说函数

关上 /include/extend.func.php 文件(注:这个文件就是零碎预留的自界说函数接口文件,次要用于二次开发用的。假如你是老版本,默许不这个文件,本人创立一个PHP文件便可),正在最上面的?>上一行退出如下函数代码:

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;       
    }   
}

标签: 织梦教程 织梦技巧 dedecms教程 dede问题解决 织梦

抱歉,评论功能暂时关闭!