搜尋
首頁CMS教程DEDECMSDedeCms autoindex和itemindex怎麼用

DedeCms autoindex和itemindex怎麼用

DedeCms autoindex和itemindex怎麼用?

autoindex/itemindex 可以使用@me 1;實作由指定數字開始,以下為大家詳細介紹下具體的兩者俱體的用法,有興趣的朋友可以參考下

  推薦學習:織夢cms

#程式碼如下:

<span style="color: rgb(51, 51, 51); font-family: 宋体, arial, helvetica, sans-serif; font-size: 14px; line-height: 26px; "></span>

讓dedecms autoindex,itemindex 從0到1開始的方法 

程式碼如下:

[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global] 
{dede:global name=itemindex runphp="yes"}@me=@me+1;{/dede:global}

autoindex itemindex 的使用心得區別 

channelartlist 标签下使用 {dede:global name=&#39;itemindex&#39; runphp=&#39;yes&#39;}@me;{/dede:global}

自增1 

arclist 标签下使用 [field:global.autoindex/] 默认从1开始 
channel 标签下使用 [field:global.autoindex/] 默认从0开始 
channelartlist 标签下使用 {dede:global.itemindex/} 默认从1开始 
arclist 从0开始[field:global name=autoindex runphp="yes"]@me=@me-1;[/field:global] 
channel 从1开始[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global][field:typename/] 
channelartlist 从0开始{dede:global name=itemindex runphp=&#39;yes&#39;}@me=@me-1;{/dede:global} 
<div id="h_pd_lm_{dede:global.itemindex/}" {dede:global name=&#39;itemindex&#39; runphp=&#39;yes&#39;}@me=(@me==1)?&#39;&#39;:&#39;style="display:none;"&#39;;{/dede:global} class="pd2_lmc_l1">

channelartlist實例 

#程式碼如下:

{dede:channelartlist notypeid=&#39;123,124,146,147&#39;} 
<a class="pd2_lmt{dede:global name=itemindex runphp=&#39;yes&#39;}@me=(@me==1)?&#39;1&#39;:&#39;3&#39;;{/dede:global}"onmouseover="showitem2({dede:global name=itemindex runphp=&#39;yes&#39;}@me=@me-1;{/dede:global},&#39;pd_lm&#39;,&#39;h_pd_lm_&#39;,&#39;pd2_lmt&#39;);" href=&#39;{dede:field name=&#39;typeurl&#39;/}&#39;> 
{dede:php}if($refObj->Fields[&#39;ispart&#39;]){echo $refObj->Fields[&#39;typename&#39;];}{/dede:php} 
</a> 
{/dede:channelartlist}

標籤下使用[field:global name=autoindex/] 

channel實例 

程式碼如下:

{dede:channel titlelen=&#39;32&#39;} 
<li [field:global name=&#39;autoindex&#39;runphp=&#39;yes&#39;]if(@me%2==0){@me=&#39;class="rr"&#39;;}else{@me=&#39;&#39;;}[/field:global] ><h3 id="a-nbsp-href-field-typelink-field-typename-a"><a href=&#39;[field:typelink/]&#39;>[field:typename/]</a></h3></li> 
{/dede:channel}

在arclist中使用autoindex runphp 時用這種方式: 

程式碼如下:

{dede:arclist titlelen=&#39;22&#39; row=&#39;4&#39; flag=&#39;c&#39; orderby=&#39;id&#39;} 
<a href="[field:arcurl /]" target="_blank">[field:title /]</a> 
[field:global name=&#39;autoindex&#39; runphp=&#39;yes&#39;]if(@me==2){@me="
";}else{@me=&#39; &#39;;}[/field:global]{/dede:arclist}

自增1 

[field:global.autoindex/]

arclist實例 

程式碼如下:

{dede:arclist channelid=17 row=6 orderby=pubdate titlelen=40 addfields=&#39;docphoto,docjob,doctec&#39;typeid=&#39;123,136,146,155,172,182,202&#39;} 
<div id="h_nrr_zj_[field:global.autoindex/]"class="nrr_zjl" [field:global name=&#39;autoindex&#39;runphp=&#39;yes&#39;]if(@me==1){@me="";}else{@me=&#39;style="display:none;"&#39;;}[/field:global] > 
<div><a href="[field:arcurl/]" title="[field:fulltitle/]" target="_blank"><img src="/static/imghwm/default1.png"  data-src="[field:litpic/]"  class="lazy"  alt="[field:fulltitle/]" /></a></div> 
</div> 
{/dede:arclist}

如何自由訂開始的數字 

#autoindex/itemindex 可以使用@me 1;實作由指定數字開始 

遇到類似的問題做下這個筆記,在用到的時候可以靈活發揮!

list 標籤下試用autoindex 

程式碼如下:

{dede:list pagesize=&#39;40&#39; orderby=&#39;id&#39;} 
[field:global name=&#39;autoindex&#39; runphp=&#39;yes&#39;]if(@me%10==0){@me="test";}else{@me=&#39;&#39;;}[/field:global] 
{/dede:list}

對autoindex/itemindex使用自訂函數 

先在include/extend.fun.php裡面加入自訂函數 

程式碼如下:

function MyPosition($p){ 
$positionArr=array(275,330,380,435,495,547); 
return $positionArr[$p];

然後在模板裡加入 

程式碼如下:

{dede:channel type=&#39;son&#39; typeid=&#39;13&#39; row=&#39;6&#39; noself=&#39;yes&#39;} 
<!-----侧栏菜单------------------> 
<div id=&#39;pdv_16795&#39; class=&#39;pdv_class&#39; title=&#39;&#39; style="width:71px;height:20px;top:[field:global.autoindex function=&#39;MyPosition(@me)&#39;/]px;left:136px; z-index:17"> 
<div style="FONT-FAMILY: SimSun; COLOR: #fecd2e; FONT-SIZE: 15px; fon-weight: bold"><a style="FONT-FAMILY: SimSun; COLOR: #fecd2e; FONT-SIZE: 15px; fon-weight: bold" href="[field:typeurl/]" target=_blank><strong>[field:typename/]</strong></a></div> 
</div> 
{/dede:channel}

以上是DedeCms autoindex和itemindex怎麼用的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

DVWA

DVWA

Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

EditPlus 中文破解版

EditPlus 中文破解版

體積小,語法高亮,不支援程式碼提示功能

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器