在为客户做网站的时候需要做到的效果是每个案例都要很多图片,并且用一定的效果进行展示。但是发现织梦本身自带的调取方法实现的效果是一次性调取多个参数,并且展现的效果不是我需要的,当时很纠结。后来自己琢磨琢磨,可惜没成功。最后通过网络百度搜索找到了实现方法。
实现的方法一共有两个步骤:
1、在/include/common.func.php 里加上方法 //循环输出多张图片function
复制代码代码如下:
function Get($aid, $, $, $num = 0, $style = ''){
global $dsql;
$'';
$row = $dsql -> getone("Select `dede_addonimages` where aid='$aid'"); //
$$row<''>;
preg_match_all("/{dede:(.*)}(.*){\/dede:", $, $wordcount);
$count = count($wordcount<2>);
if ($num > $count || $num == 0){
$num = $count;
}
for($i = 0;$i
";
}else{
$"

";
}
}
return $;
}
2、在模板里调用方法{dede:field.id function="Get(@me,400,400,10)" /}
文章来源