首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >DedeCms织梦在图集标签(productimagelist)中添加自增的方法

DedeCms织梦在图集标签(productimagelist)中添加自增的方法

作者头像
SDDLL学院
发布2022-09-18 18:20:57
发布2022-09-18 18:20:57
3.5K0
举报
文章被收录于专栏:站长技术站长技术

织梦源代码修改:

打开 /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.lol9.cn" width="200" height="300" /></span>

{/dede:productimagelist}

输出html代码:

<span id="0"><img src="1.jpg" alt="www.lol9.cn" width="200" height="300" /></span>

<span id="1"><img src="2.jpg" alt="www.lol9.cn" width="200" height="300" /></span>

<span id="2"><img src="3.jpg" alt="www.lol9.cn" width="200" height="300" /></span>

本文系转载,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档