织梦园模板网专注于织梦企业模板、DeDe整站模板、织梦Html5模板等织梦模板的下载,提供DEDE织梦模板相关服务。织梦园织梦模板交流群
用户名:
密码:
注册
499元建站一条龙咨询

微信扫码咨询

扫码加微信,聊 499 元建站方案
人工全程包办,先了解再决定

织梦园微信客服二维码

不方便扫码?加 QQ:45420794

织梦dede给productimagelist图集标签添加数字编号自增递增的方法

织梦园模板 / 2018-03-16 / 收藏
源代码修改:
打开 /include/taglib/productimagelist.lib.php 文件
 
找到:
$ctp->LoadSource($innerText);
 
在此代码下边添加如下代码:
$GLOBALS['autoindex'] = 0;
 
找到:
$revalue .= $ctp->GetResult();
在此代码下边添加如下代码:
 
$GLOBALS['autoindex']++;
 
调用代码:
[field:global name=autoindex/]
 
示例:
{dede:productimagelist}
<span id="[field:global name=autoindex/]"><img src="[field:imgsrc/]" alt="www" width="200" height="300" /></span>
{/dede:productimagelist}
 
输出html代码:
<span id="0"><img src="1.jpg" alt="www" width="200" height="300" /></span>
<span id="1"><img src="2.jpg" alt="www" width="200" height="300" /></span>
<span id="2"><img src="3.jpg" alt="www" width="200" height="300" /></span>

相关织梦教程

收缩