織夢dedecms模板制作時,循環遞增autoindex使用方法整理。
{dede:arclist titlelen='26' row='10'}<li><a title="[field:title function='htmlspecialchars(@me)'/] " href="[field:arcurl /]">[field:title /]</a></li> [field:global name=autoindex runphp="yes"]if(@me%5==0)@me="<br/>";else @me="";[/field:global]{/dede:arclist}紅色的即為autoindex標簽用法。意思是,循環調用文章時,到第五條時輸出<br/>,否則輸出空。這樣我們就實現了第五篇文章下面進行換行。配合css和簡單的php等代碼使用,達到更多效果。
循環+1的寫法:
[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global]
頻道頁使用時可以換成itemindex標簽,原理同autoindex
{dede:global name='itemindex'/}{dede:global name='itemindex' runphp='yes'}if(@me%5==0)@me="<br/>";else @me="";{/dede:global}{dede:global name='itemindex' runphp='yes'}@me=@me+1;{/dede:global}織夢默認的搜索頁不支持autoindex標簽,需要修改核心文件增加支持:
找到文件:include/arc.searchview.class.php
里面找到代碼:
$this->dtp2->LoadSource($innertext);
下面加上:
$GLOBALS['autoindex'] = 0;------------------------------------if($row = $this->dsql->GetArray("al")){下面加上:
$GLOBALS['autoindex']++; $ids[$row['id']] = $row['id'];以上就是織夢dedecms模板制作時,循環遞增autoindex使用方法整理的全部內容,希望對大家的學習和解決疑問有所幫助,也希望大家多多支持武林網。
新聞熱點
疑難解答