dedecms图集茬首页列表页调用并且自定义輸出几张
打开includeextend.func.php在最下面加入这个方法
functionGetimgurls($aid,$num=IV)
{
global$dsql;
更多精彩就在: 51免费论文网|www.jxszl.com
$imgurls=$result=;
$imgrow=$dsql->GetOne("SelectimgurlsFrom`mydiy_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,V)/]
数字V是调用本图集中的V张图
原文链接:http://www.jxszl.com/biancheng/dedecms/73411.html