dedecms织梦图集在首页列表页调用并且自定义输出
导读:织梦教程织梦教程效果 不改动官方核心文件,在自定义方法文件里加入个方法来实现 打开 \include\extend.func.php 在最下面加入这个方法 function G织梦文章模板梦织模板。
效果
不改动官方核心文件,在自定义方法文件里加入个方法来实现
打开 \include\extend.func.php 在最下面加入这个方法
function Getimgurls($aid,$num=4)
{
global $dsql;织梦模板免费
$imgurls = $result = '';
$imgrow = $dsql->GetOne( "Select imgurls From `dede_addonimages` where aid='$aid' ");
$imgurls = $imgrow['imgurls'];
if($imgurls != '')
{
$dtp = new DedeTagParse();
$dtp->LoadSource($imgurls);
$images = array();
&织梦模板安装nbsp; if(is_array($dtp->CTags))
{
foreach($dtp->CTags as $ctag)
{
if($ctag->GetName() == 'img')
{
$ro织梦手机模板w = 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><div class='pic'><a title='{$row['text']}' href='{$row['imgsrc']}'><img src='{$row['imgsrc']}' mid='{$row['imgsrc']}' big='{$row['imgsrc']}' width='70' height='70'></a></div></li>";
}
$i++;
}
return $result;
}
}
上面代码中标红的地方改成你自己的,注意单双引号
前台模板 首页 或者 列表页 中调用
[field:id function=Getimgurls(@me,4)/]
数字4是调用几张图片
本文来源于:http://www.cnblogs.com/dedediy/p/7039910.html Power by dedediy相关织梦文章模板梦织模板。
声明: 本文由我的SEOUC技术文章主页发布于:2023-07-18 ,文章dedecms织梦图集在首页列表页调用并且自定义输出主要讲述自定义,几张,织梦网站建设源码以及服务器配置搭建相关技术文章。转载请保留链接: https://www.seouc.com/article/web_29163.html