POST TIME:2020-03-30 16:19
織夢DedeCMS網站內容模型普通文章調用自定義圖片字段的方法:
我們首先需要創建一個自定義函數,
找到:/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.'" />';
下一篇:織夢如何去掉網站底部版權信息