POST TIME:2021-05-24 23:39
在圖集內(nèi)容頁調(diào)用圖集的時(shí)候,如果使用某些幻燈片特效或者jquery插件,難免會(huì)用到ID編號(hào)什么的,本教程將教會(huì)你如何給圖集圖片自動(dòng)編號(hào),也就是說,讓{dede:productimagelist}標(biāo)簽支持自動(dòng)編號(hào),非常簡(jiǎn)單。
打開include/taglib/productimagelist.lib.php文件,找到:
$ctp->LoadSource($innerText);
在其后面另起一行加入
$GLOBALS['autoindex']=0;
找到:
$revalue.=$ctp->GetResult();
在其后面另起一行加入
$GLOBALS['autoindex']++;
這里的改動(dòng)就算完了,接下來是內(nèi)容頁里調(diào)用:
[field:globalname=autoindex/]
例子:
{dede:productimagelist} <spanid="[field:globalname=autoindex/]"><imgsrc="[field:imgsrc/]"width="805"height="523"/></span> {/dede:productimagelist}
結(jié)果:
<spanid="0"><imgsrc="1.jpg"width="805"height="523"/></span> <spanid="1"><imgsrc="2.jpg"width="805"height="523"/></span> <spanid="2"><imgsrc="3.jpg"width="805"height="523"/></span> ......