今天看见一个标签[field:global runphp='yes' name=autoindex,[/field:global,开始有点奇怪他的原理,后来分析了下源码。还是很简单的。 arclist标签在执行过程中,会声明一个全局变量$GLOBALS['autoindex',=0]然后随着执行每一条数据对其自增长$GLOBALS['autoindex',++,而runphp='yes'是你想在标签内进行有限的PHP编程前必须声明的。 织梦列表自动编号的方法(注意autoindex itemindex 的使用心得区别 ): [field:global name=autoindex runphp="yes",@me=@me+1;[/field:global, {dede:global name=itemindex runphp="yes"}@me=@me+1;{/dede:global} 其他几个列表标签的自增长如下,在网上找的,新版是否一样还需要验证 arclist 标签下使用 [field:global.autoindex/] 默认从1开始 channel 标签下使用 [field:global.autoindex/] 默认从0开始 channelartlist 标签下使用 {dede:global.itemindex/} 默认从1开始 对这个自增标签进行一个简单的小扩展, [field:global runphp='yes' name=autoindex, if (@me else @me = @me; [/field:global, 这样就会显示 01 02 03...09这样的编号列表样式...
内容已隐藏,请关注公众号输入验证码查看
本帖支持关注公众号查看
【无套路 无套路 无套路 扫描二维码关注公众号发送【验证码】收到验证码 在上面输入点击提交查看即可显示隐藏内容】
|