織夢dedecms模板制作時,循環遞增autoindex使用方法整理_DedeCms教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!
      織夢dedecms模板制作時,循環遞增autoindex使用方法整理。僅供大家學習參考,希望對你有所幫助。
      1. {dede:arclist titlelen='26' row='10'
      2.   
      3. <li><a title="[field:title function='htmlspecialchars(@me)'/] " href="[field:arcurl /]">[field:title /]</a></li> 
      4.   
      5.  [field:global name=autoindex runphp="yes"]if(@me%5==0)@me="<br/>";else @me="";[/field:global] 
      6.   
      7. {/dede:arclist} 
      紅色的即為autoindex標簽用法。意思是,循環調用文章時,到第五條時輸出<br/>,否則輸出空。這樣我們就實現了第五篇文章下面進行換行。配合css和簡單的php代碼使用,達到更多效果。
      循環+1的寫法:
      1. [field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global] 
      2. 頻道頁使用時可以換成itemindex標簽,原理同autoindex 
      3.   
      4. {dede:global name='itemindex'/} 
      5. {dede:global name='itemindex' runphp='yes'}if(@me%5==0)@me="<br/>";else @me="";{/dede:global} 
      6. {dede:global name='itemindex' runphp='yes'}@me=@me+1;{/dede:global} 
      織夢默認的搜索頁不支持autoindex標簽,需要修改核心文件增加支持:
      1. 找到文件:include/arc.searchview.class.php 
      2. 里面找到代碼:$this->dtp2->LoadSource($innertext); 
      3. 下面加上: 
      4. $GLOBALS['autoindex'] = 0; 
      5. ------------------------------------ 
      6. if($row = $this->dsql->GetArray("al")) 
      7. 下面加上: 
      8.  $GLOBALS['autoindex']++; 
      9.  $ids[$row['id']] = $row['id']; 
      有需要的可以來記錄下來。


      查看更多 DedeCms教程  織夢模板  織夢DedeCms視頻教程  織夢dedecms專題

      來源:模板無憂//所屬分類:DedeCms教程/更新時間:2020-05-16
      相關DedeCms教程