今天,AB模板网就教大家怎样在织梦的图集中调用当前文档的所有图片及注释。 翻开/include/common.func.php,在最后" />

百分百源码网-让建站变得如此简单! 登录 注册 签到领金币!

主页 | 如何升级VIP | TAG标签

当前位置: 主页>网站教程>织梦CMS教程> 织梦DedeCMS图集调用所有图片及注释的办法
分享文章到:

织梦DedeCMS图集调用所有图片及注释的办法

发布时间:09/08 来源:未知 浏览: 关键词:
我们都知道织梦的图集默认调用语法是:{dede:field name='imgurls' src="/uploads/allimg/190908/error190.html"/>
 
今天,AB模板网就教大家如何在织梦的图集中调用当前文档的所有图片及注释。
 
打开/include/common.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);
$textinfo = $wordcount[1];
$count = count($wordcount[2]);
if ($num > $count || $num == 0){$num = $count;}
for($i = 0;$i < $num;$i++){
$textinfoe = $textinfo[$i];
$textinfoee = explode(" ",$textinfoe);
$imglist .= "<li class='slider-item'>"."<img src='".trim($wordcount[2][$i])."' alt='".substr($textinfoee[1],6,-1)."' width='".$imgwith."' height='".$imgheight."'>"."<span class='slider-title'>"."<em>".substr($textinfoee[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 拼字符串,根据自己需求拼写即可
 
打赏

打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

百分百源码网 建议打赏1~10元,土豪随意,感谢您的阅读!

共有157人阅读,期待你的评论!发表评论
昵称: 网址: 验证码: 点击我更换图片
最新评论

本文标签

广告赞助

能出一分力是一分吧!

订阅获得更多模板

本文标签

广告赞助

订阅获得更多模板