织梦CMS图集调用所有图片及注释的方法
网站建设 2022-07-27 08:13www.1681989.com免费网站
我们都知道织梦的图集默认调用语法是 {dede:field name=imgurls src=https://.dedesos./uploads/allimg/180903/1-1PZ3150P70-L.jpg/ 今天,推火专家就教大家如何在织梦的图集中调用当前文档的所有图片及注释。 打开 /clude/mon.func.php ,在面加上推火网以下代码 //循环输出图集全部图片及注释 function Getimgs($aid, $imgwith, $imgheight, $num […]
//循环输出图集全部图片及注释
function Getimgs($aid, $imgwith, $imgheight, $num){
global $dsql;
$imgurls = '';
$row = $dsql -> getone("Select From`aier_addonimages` where aid='$aid'"); //
$imgurls = $row['imgurls'];
preg_match_all("/{dede:img (.)}(.){/dede:img/isU", $imgurls, $wordcount);
$textfo = $wordcount[1];
$count = count($wordcount[2]);
if ($num > $count || $num == 0){$num = $count;}
for($i = 0;$i < $num;$i++){
$textfoe = $textfo[$i];
$textfoee = explode(" ",$textfoe);
$imglist .= "<li class='slider-item'>"."<img src='".trim($wordcount[2][$i])."' alt='".substr($textfoee[1],6,-1)."' width='".$imgwith."' height='".$imgheight."'>"."<span class='slider-title'>"."<em>".substr($textfoee[1],6,-1)."</em>"."</span>"."</li>";
}
return $imglist;
}
{dede:arclist typeid=''} [field:id function="Getimgs(@me,80,70,7)"/] {/dede:arclist]
{dede:list} [field:id function="Getimgs(@me,80,70,7)"/] {/dede:list}
{dede:field.id function="Getimgs(@me,80,70,7)"/}
我们都知道织梦的图集默认调用语法是{dede:field name='imgurls' src="https://.dedesos./uploads/allimg/180903/1-1PZ3150P70-L.jpg"/>
今天,推火专家就教大家如何在织梦的图集中调用当前文档的所有图片及注释。
打开/clude/mon.func.php,在面加上推火网以下代码
//循环输出图集全部图片及注释
function Getimgs($aid, $imgwith, $imgheight, $num){
global $dsql;
$imgurls = '';
$row = $dsql -> getone("Select From`aier_addonimages` where aid='$aid'"); //
$imgurls = $row['imgurls'];
preg_match_all("/{dede:img (.)}(.){/dede:img/isU", $imgurls, $wordcount);
$textfo = $wordcount[1];
$count = count($wordcount[2]);
if ($num > $count || $num == 0){$num = $count;}
for($i = 0;$i < $num;$i++){
$textfoe = $textfo[$i];
$textfoee = explode(" ",$textfoe);
$imglist .= "<li class='slider-item'>"."<img src='".trim($wordcount[2][$i])."' alt='".substr($textfoee[1],6,-1)."' width='".$imgwith."' height='".$imgheight."'>"."<span class='slider-title'>"."<em>".substr($textfoee[1],6,-1)."</em>"."</span>"."</li>";
}
return $imglist;
}
在首页调用语法
{dede:arclist typeid=''} [field:id function="Getimgs(@me,80,70,7)"/] {/dede:arclist]
在列表页调用语法
{dede:list} [field:id function="Getimgs(@me,80,70,7)"/] {/dede:list}
在内容页调用语法
{dede:field.id function="Getimgs(@me,80,70,7)"/}
释义
1、$imglist .=这段后面的代码可以根据实际情况调整,为我们网站的html代码
2、80代表长,70代表宽,7代表张数
3、$imglist 拼字符串,根据自己需求拼写即可
网站设计
- 静宁会SEO的网站建设公司:全面提升您的网络影
- 提升在线业务的关键:选择最佳的丽水网站建设
- 浙江网站优化发展潜力如何
- 井研专业的网站建设公司:打造您的在线品牌
- 灵山SEO网站建设公司:提升您的在线业务表现
- 蒙城网站建设优化公司:提升您网站表现的理想
- 阳谷企业网站优化:提升线上业务力的关键
- 樟树专业的网站建设公司:打造您在线业务的坚
- 通河百度SEO排名的策略与技巧
- 重庆百度快照排名如何进行精准的客户引流
- 重庆百度快照排名
- 常宁便宜的建站公司:助您轻松打造在线业务
- 巫溪百度网站优化:提升网站曝光率与流量的关
- 湖北整站优化怎么做才能放大客户需求
- 闸北网站建设多少钱?全面解析与预算规划
- 辽宁企业网站优化怎么做电话营销