织梦园模板网提供云优cms模板,pbootcms模板,Wordpress主题模板等各类企业新闻资讯网站模板下载服务。织梦园网站模板交流群
用户名:
密码:
注册
注册后享受折扣价

织梦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>

相关织梦教程

收缩