DEDECMS自动编号(序号)autoindex属性

让织梦dedecms autoindex,itemindex 从0到1开始的办法!

1
2
3
[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 标签下使用 

1
{dede:global name='itemindex' runphp='yes'}@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='yes'}@me=@me-1;{/dede:global}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<div id="h_pd_lm_{dede:global.itemindex/}" {dede:global name='itemindex' runphp='yes'}@me=(@me==1)?'':'style="display:none;"';{/dede:global} class="pd2_lmc_l1">
  
eg---->
  
{dede:channelartlist  notypeid='123,124,146,147'}
     <a class="pd2_lmt{dede:global name=itemindex runphp='yes'}@me=(@me==1)?'1':'3';{/dede:global}" onmouseover="showitem2({dede:global name=itemindex runphp='yes'}@me=@me-1;{/dede:global},'pd_lm','h_pd_lm_','pd2_lmt');" href='{dede:field name='typeurl'/}'>
{dede:php}if($refObj->Fields['ispart']){echo $refObj->Fields['typename'];}{/dede:php}
     </a>
{/dede:channelartlist}
  
{dede:channelartlist typeid="1" row="8" }
<div class="combz01" {dede:global name=itemindex runphp='yes'}if(@me==2)@me='id="with"';if(@me==5)@me='id="with"';if(@me==7)@me='id="with"';{/dede:global}>
<div class="combz01title"><a href="{dede:field name='typeurl'/}" title="{dede:field name='typename'/}" target="_blank"><b>{dede:field name='typename'/}</b></a><u><a href="{dede:field name='typeurl'/}" title="{dede:field name='typename'/}" target="_blank">更多>></a></u></div>
<div class="comcon">
{dede:arclist titlelen='42' row='1' flag='c'}
<img src="[field:litpic/]" width="127" height="94"/>
<i>[field:description function="cn_substr(@me,100)"/]...<a href="[field:arcurl /]" title="[field:fulltitle/]" target="_blank">[详情]</a></i>
{/dede:arclist}
</div>
<div class="comconlist">
<ul>
 {dede:arclist titlelen="42" row="3"}
 <li><a href="[field:arcurl /]">[field:title /]</a></li>
 {/dede:arclist}
</ul>
</div>
</div>
{/dede:channelartlist}

channel 标签下使用[field:global name=autoindex/]  

1
2
3
4
5
6
7
8
9
10
11
12
13
eg---->
 
{dede:channel titlelen='32'}
        <li [field:global name='autoindex' runphp='yes']if(@me%2==0){@me='class="rr"';}else{@me='';}[/field:global] ><h3><a href='[field:typelink/]'>[field:typename/]</a></h3></li>
{/dede:channel}
 
 
 
在arclist中使用autoindex runphp 时用这种方式:
 
{dede:arclist titlelen='22' row='4' flag='c' orderby='id'}
      <a href="[field:arcurl /]" target="_blank">[field:title /]</a>
       [field:global name='autoindex' runphp='yes']if(@me==2){@me="<br />";}else{@me=' ';}[/field:global]{/dede:arclist}

自增1

 [field:global.autoindex/]

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

原文链接: http://blog.csdn.net/a1079540945/article/details/38678155

原文地址:https://www.cnblogs.com/weibo806/p/5213125.html