dedecms autoindex和itemindex怎么用?
autoindex/itemindex 可以使用 @me+1;实现由指定数字开始,下面为大家详细介绍下具体的两者具体的用法,感兴趣的朋友可以参考下
推荐学习:织梦cms
代码如下:
1
<span></span>
让dedecms autoindex,itemindex 从0到1开始的办法
代码如下:
1
2
[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global]
{dede:global name=itemindex runphp="yes"}@me=@me+1;{/dede:global}
autoindex itemindex 的使用心得区别
1
channelartlist 标签下使用 {dede:global name=itemindex runphp=yes}@me;{/dede:global}
自增1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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>
<p>channelartlist实例 </p>
<p>代码如下:</p>
<pre class="brush:php;toolbar:false">{dede:channelartlist notypeid=123,124,146,147}
<a>
{dede:php}if($refObj->Fields[ispart]){echo $refObj->Fields[typename];}{/dede:php}
</a>
{/dede:channelartlist}
标签下使用 [field:global name=autoindex/]
channel实例
代码如下:
1
{dede:channel titlelen=32}
[field:typename/]
{/dede:channel}代码如下:
1
2
3
4
{dede:arclist titlelen=22 row=4 flag=c orderby=id}
<a>[field:title /]</a>
[field:global name=autoindex runphp=yes]if(@me==2){@me="
";}else{@me=;}[/field:global]{/dede:arclist}
自增1
1
[field:global.autoindex/]
arclist实例
代码如下:
1
2
3
4
5
{dede:arclist channelid=17 row=6 orderby=pubdate titlelen=40 addfields=docphoto,docjob,doctectypeid=123,136,146,155,172,182,202}
<div>
<div><a>@@##@@</a></div>
</div>
{/dede:arclist}
如何自由定义 开始的数字
autoindex/itemindex 可以使用 @me+1;实现由指定数字开始
遇到类似的问题做下这个笔记,在用到的时候可以灵活发挥!
list 标签下试用autoindex
代码如下:
1
2
3
{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里添加自定义函数
代码如下:
1
2
3
function MyPosition($p){
$positionArr=array(275,330,380,435,495,547);
return $positionArr[$p];
然后在模板里添加
代码如下:
1
2
3
4
5
6
{dede:channel type=son typeid=13 row=6 noself=yes}
<!-----侧栏菜单------------------>
<div>
<div><a><strong>[field:typename/]</strong></a></div>
</div>
{/dede:channel}
