$imgurls=$imgrow[imgurls];
if($imgurls!=)
{<" />

"景先生毕设|www.jxszl.com

dedecms织梦图集茬首页或列表页调用并自定义显示几张图

2022-10-29 16:14编辑: www.jxszl.com景先生毕设
打开include/extend.func.php在最下面加入这个方法
functionGetimgurls($aid,$num=III)
{
global$dsql;
$imgurls=$result=;
$imgrow=$dsql->GetOne("Sel

 更多精彩就在: 51免费论文网|www.jxszl.com 
ectimgurlsFrom`dede_addonimages`whereaid=$aid");
$imgurls=$imgrow[imgurls];
if($imgurls!=)
{
$dtp=newDedeTagParse();
$dtp->LoadSource($imgurls);
$images=array();
if(is_array($dtp->CTags))
{
foreach($dtp->CTagsas$ctag)
{
if($ctag->GetName()==img)
{
$row=array();
$row[width]=$ctag->GetAtt(width);
$row[height]=$ctag->GetAtt(height);
$row[imgsrc]=trim($ctag->GetInnerText());
$row[text]=$ctag->GetAtt(text);
$images[]=$row;
}
}
}
$dtp->Clear();
$i=0;
foreach($imagesas$row)
{
if($i==$num)break;
if($row[imgsrc]!=)
{
$result.="
  • ";
    }
    $i++;
    }
    return$result;
    }
    }

    请注意


  • 上面这段代码改成符合自己页面的html格式.
    前台模板中调用代码如下:

    [field:idfunction=Getimgurls(@me,III)/]


    III表示,此篇图集调用III张图片.


    原文链接:http://www.jxszl.com/biancheng/dedecms/73912.html