在圖集內(nèi)容頁調(diào)用圖集地時(shí)候,如果使用某些幻燈片特效或者jquery插件,難免會(huì)用到id編號(hào)什么地,本教程將教會(huì)你如何給圖集圖片自動(dòng)編號(hào),也就是說,讓{dede:productimagelist}標(biāo)簽支持自動(dòng)編號(hào),非常簡單.
打開include/taglib/productimagelist.lib.php文件,找到:
$ctp->loadsource($innertext);
在其后面另起一行加入
$globals['autoindex'] = 0;
找到:
$revalue .= $ctp->getresult();
在其后面另起一行加入
$globals['autoindex']++;
這里地改動(dòng)就算完了,接下來是內(nèi)容頁里調(diào)用:
[field:global name=autoindex/]
例子:
{dede:productimagelist}
<span id=[field:global name=autoindex/]><img src=[field:imgsrc/] width=805 height=523 /></span>
{/dede:productimagelist}
假如有3個(gè)圖片,則結(jié)果為:
<span id=0><img src=1.jpg width=805 height=523 /></span>
<span id=1><img src=2.jpg width=805 height=523 /></span>
<span id=2><img src=3.jpg width=805 height=523 /></span>
你學(xué)會(huì)了么?
更多信息請(qǐng)查看IT技術(shù)專欄