m/tag/323/" title="查看含有 e 标签的文章" target="_blank">ef="https://www.ibytx.com/tag/205/" title="查看含有 dedecms 标签的文章" target="_blank">dedecms图集在首页列表页调用并且自定义输出几张图片,不改动官方核心文件。
打开 includeextend.func.php 在最下面加入这个方法
function Getimgurls($aid,$num=4)
{
global $dsql;
$imgurls = $result = ”;
$imgrow = $dsql->GetOne( “Select imgurls From `mydiy_addonimages` where aid=’$aid’ “);
$imgurls = $imgrow[‘imgurls’];
if($imgurls != ”)
{
$dtp = new DedeTagParse();
$dtp->LoadSource($imgurls);
$images = array();
if(is_array($dtp->CTags))
{
foreach($dtp->CTags as $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($images as $row)
{
if($i == $num) break;
if($row[‘imgsrc’] != ”)
{
$result .= “<li><a title='{$row[‘text’]}’ href='{$row[‘imgsrc’]}’><img src='{$row[‘imgsrc’]}’ mid='{$row[‘imgsrc’]}’ big='{$row[‘imgsrc’]}’ width=’70’ height=’70’></a></li>”;
}
$i++;
}
return $result;
}
}
注意
<li><a title='{$row[‘text’]}’ href='{$row[‘imgsrc’]}’><img src='{$row[‘imgsrc’]}’ mid='{$row[‘imgsrc’]}’ big='{$row[‘imgsrc’]}’ width=’70’ height=’70’></a></li>
这块根据自己页面的实际布局,自行修改Html标签
前台模板 首页 或者 列表页 中调用
[field:id function=Getimgurls(@me,5)/]
数字5是调用本图集中的5张图
dedecms织梦图集在首页列表页调用并且自定义输出几张的教程
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《dedecms织梦图集在首页列表页调用并且自定义输出几张的教程》
文章链接:https://www.ibytx.com/1132.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
文章名称:《dedecms织梦图集在首页列表页调用并且自定义输出几张的教程》
文章链接:https://www.ibytx.com/1132.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

博悦天下







![[email protected] :美国/新加坡/香港多机房VPS特价优惠中,年付$20起-博悦天下](https://www.ibytx.com/wp-content/uploads/2021/01/20210127_6010ff4ec740f.png)


