织梦图集图片{dede:productimagelist}标签自动编号
在织梦图集内容页调用图集的时候,如果使用某些幻灯片特效或者jquery插件,会用到ID编号什么的,本教程将教会你如何给图集图片自动编号,也就是说,让{dede:productimagelist}标签支持自动编号。
打开clude/taglib/productimagelist.lib.php文件,找到
$ctp->LoadSource($nerText);
在它下面加上
$GLOBALS['autodex'] = 0;
查找:
$revalue .= $ctp->GetResult();
在它下面加上
$GLOBALS['autodex']++;
内容页调用代码
[field:global name=autodex/]
例
{dede:productimagelist}
<span id="[field:global name=autodex/]"><img src="[field:imgsrc/]" width="805" height="523" /></span>
{/dede:productimagelist}
显示代码结果
<span id="0"><img src="1.jpg" width="605" height="380" /></span>
<span id="1"><img src="2.jpg" width="605" height="380" /></span>
<span id="2"><img src="3.jpg" width="605" height="380" /></span>