在織夢DedeCMS網站中如果有幻燈片的話,那圖片肯定也是從圖集中調用,圖集中圖片的命名都是比較長的,如果在幻燈片中能讓{dede:productimagelist}標簽支持自動編號,就可以讓圖片的名字變短一點。
打開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/]" width="805" height="523" /></span>
{/dede:productimagelist}
假如有3個圖片,則結果為:
<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>
新聞熱點
疑難解答