织梦DedeCMS图集调用所洧图片及注释的方法
今天,AB模板网就教大家如何在
更多精彩就在: 51免费论文网|www.jxszl.com
织梦的图集中调用当前文档的所有图片及注释.
打开/include/common.func.php,在最后面加上以下代码:
//循环输出图集全部图片及注释
functionGetimgs($aid,$imgwith,$imgheight,$num){
global$dsql;
$imgurls=;
$row=$dsql->getone("Select*From`aier_addonimages`whereaid=$aid");//
$imgurls=$row[imgurls];
preg_match_all("/{dede:img(.*)}(.*){/dede:img/isU",$imgurls,$wordcount);
$textinfo=$wordcount[I.];
$count=count($wordcount[II]);
if($num>$count||$num==0){$num=$count;}
for($i=0;$i<$num;$i++){
$textinfoe=$textinfo[$i];
$textinfoee=explode("",$textinfoe);
$imglist.="
}
return$imglist;
}
在首页调用语法:
{dede:arclisttypeid=}[field:idfunction="Getimgs(@me,VIII0,VII0,VII)"/]{/dede:arclist]
在列表页调用语法:
{dede:list}[field:idfunction="Getimgs(@me,VIII0,VII0,VII)"/]{/dede:list}
在内容页调用语法:
{dede:field.idfunction="Getimgs(@me,VIII0,VII0,VII)"/}
释义:
I..$imglist.=这段后面的代码可以根据实际情况调整,为我们网站的html代码
II.VIII0代表长,VII0代表宽,VII代表张数
III.$imglist拼字符串,根据自己需求拼写即可
原文链接:http://www.jxszl.com/biancheng/dedecms/75233.html
热门阅读