超全织梦dedecms autoindex和itemindex标签的使用介绍

让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='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}

 

<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">

 

channelartlist实例

 

代码如下:

 

 

 

标签下使用 

 

[field:global name=autoindex/]

 

channel实例

 

代码如下:

 

{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="

";}else{@me=' ';}[/field:global]{/dede:arclist}

 

自增1

 

[field:global.autoindex/]

 

arclist实例

 

代码如下:

 

{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}

 

如何自由定义 开始的数字

 

autoindex/itemindex 可以使用 @me+1;实现由指定数字开始

遇到类似的问题做下这个笔记,在用到的时候可以灵活发挥!

 

list 标签下试用autoindex

 

代码如下:

 

{dede:list pagesize='40' orderby='id'}

[field:global name='autoindex' runphp='yes']if(@me%10==0){@me="test";}else{@me='';}[/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='son' typeid='13' row='6' noself='yes'}

<div id='pdv_16795' class='pdv_class' title='' style="width:71px;height:20px;top:[field:global.autoindex function='MyPosition(@me)'/]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}

 


1、本网站名称:源码村资源网
2、本站永久网址:https://www.yuanmacun.com
3、本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长进行删除处理。
4、本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
5、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
6、本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。
源码村资源网 » 超全织梦dedecms autoindex和itemindex标签的使用介绍
您需要 登录账户 后才能发表评论

发表评论

欢迎 访客 发表评论