dede:field name='imgurls' alt='圖片輸出區(qū)'}<div class="遞增">[field:imgsrc/]</div>{/dede:field}
下面結(jié)果:
<div>/xxx/xxx.jpg</div>
<div>/xxx/xxx.jpg</div>
<div>/xxx/xxx.jpg</div>
<div>/xxx/xxx.jpg</div>
<div>/xxx/xxx.jpg</div>
這個遞增的標(biāo)簽是什么?
我在網(wǎng)站搜索了下沒有這個教程。 [field:global.autoindex/] 和其他遞增標(biāo)簽沒有作用。
以上是發(fā)布在織夢官方論壇的問題求解,我也稍微測試了一下,在這個標(biāo)簽內(nèi)確實(shí)無法應(yīng)用[field:global.autoindex/] ,找到相關(guān)的文件看了一下,以設(shè)置了默認(rèn)的$GLOBAL['photoid'] = 0;不過即使用這個 [field:global.photoid/] 也是不行的。
首先這個{dede:field name='imgurls' alt='圖片輸出區(qū)'}標(biāo)簽必須在發(fā)布圖集的時候選擇單頁多圖樣式,才能夠輸出所設(shè)置的圖片數(shù)。其實(shí)這個標(biāo)簽還不如下面這個標(biāo)簽?zāi)兀贿^productimagelist也不支持自增函數(shù),但是也可以通過修改實(shí)現(xiàn)。
{dede:productimagelist}
<a href="[field:imgsrc/]" title="[field:text/]"><img src="[field:imgsrc/]" /></a>
{/dede:productimagelist}
不過既然提出了imgurls標(biāo)簽的這個問題,自然也是有解決辦法的。
打開 include\taglib\channel\img.lib.php,找到,
$fields['text'] = str_replace("'","",$ctag->GetAtt('text'));
$fields['title'] = $title;
$fields['imgsrc'] = trim($ctag->GetInnerText());
$fields['imgsrctrue'] = $fields['imgsrc'];
在其下添加,
$fields['photoid'] = $GLOBAL['photoid']+1;
調(diào)用代碼: [field:global.photoid/]