autoindex/itemindex 可以使用 @me+1;实现由指定数字开始,下面为大家详细介绍下具体的两者具体的用法,感兴趣的朋友可以参考下

代码如下:

<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='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实例

 

代码如下:

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

标签下使用 [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} 

DedeCms autoindex和itemindex使用介绍的更多相关文章

  1. 让dedecms autoindex,itemindex 从0到1开始的办法! 多重样式输出(借鉴)

    原网址:http://my.oschina.net/lyx2012/blog/55888 [field:global name=autoindex runphp="yes"]@me ...

  2. 利用dedecms autoindex让文章列表加上序列号

    有些时候我们在制作模板的需要在文章标题前面加上序列号,可以通过织梦自带的autoindex属性来实现,实现方法很简单,只需要在序号递增的地方加上 这段代码就行,[field:global runphp ...

  3. dedecms {dede:php}标签用法介绍

    最简单的输入如 代码如下 复制代码 {dede:php} $numA = 1; $numB = 2; echo $numA + $numB; {/dede:php} 从上面语句可以看出dede:php ...

  4. 织梦dedecms dede plus文件作用介绍及安全设置

    一.安装设置 1.默认的后台模块中心有很多模块. 这里除了"友情链接"模块其他都可以删掉.在后台可以先卸载再删除. 2.如果是一开始就不想要的话,安装版plus目录下进行如下操作. ...

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

    让织梦dedecms autoindex,itemindex 从0到1开始的办法! 1 2 3 [field:global name=autoindex runphp="yes"] ...

  6. DedeCMS中channelartlist自增参数global.itemindex

    在 dede:channelartlist 标签下,使用: {dede:global.itemindex runphp='yes'} {/dede:global.itemindex} dede:cha ...

  7. DEDECMS自动编号(序号)autoindex属性(转)

    版权声明:本文为博主原创文章,未经博主允许不得转载. 让织梦dedecms autoindex,itemindex 从0到1开始的办法! 1 2 3 [field:global name=autoin ...

  8. 织梦dedecms列表序号从0到1开始的办法 autoindex,itemindex标签

    自增1 arclist            标签下使用 [field:global.autoindex/] 默认从1开始 channel         标签下使用 [field:global.au ...

  9. 织梦dedecms模板制作时,循环递增autoindex使用方法整理

    文章转载:http://www.maihui123.com/dedecms/2012051964.html 织梦dedecms模板制作时,我们需要每循环一次,变量加一,这是就需要使用到autoinde ...

随机推荐

  1. 递归删除.DS_Store文件

    删除svn文件 sudo find . -name ".DS_Store" -exec rm -r {} \; sudo find . -name ".git" ...

  2. [BC Round#26] Card 【各种水】

    题目链接:HDOJ - 5159 这道题的做法太多了..BC的第二题也是可以非常水的.. 算法一 我在比赛的时候写的算法是这样的.. 预处理出所有的答案,然后对于每个询问直接输出. 询问 (a, b) ...

  3. 电容式触摸控制器PCB布局

    在目前市场上可提供的PCB(印刷电路板)基材中,FR4是最常用的一种.FR4是一种玻璃纤维增强型环氧树脂层压板,PCB可以是单层或多层. 在触摸模块的尺寸受限的情况下,使用单层PCB不是总能行得通的, ...

  4. Replicate String in C#

    My original posting on string repetition caused a couple responses, and is currently among the Top P ...

  5. JFS 文件系统概述及布局分析

    JFS 文件系统概述及布局分析 日志文件系统如何缩短系统重启时间 如果发生系统崩溃,JFS 提供了快速文件系统重启.通过使用数据库日志技术,JFS 能在几秒或几分钟之内把文件系统恢复到一致状态,而非日 ...

  6. Python操作Excel_输出所有内容(包含中文)

    python 2.7.5代码: # coding=utf-8 import sys import xlrd data=xlrd.open_workbook('D:\\menu.xls') table ...

  7. C#控制台程序中处理2个关闭事件的代码实例

    我们开发的控制台应用,在运行阶段很有可能被用户Ctrl+C终止或是被用户直接关闭.如果我们不希望用户通过Ctrl+C终止我们的程序,就需要对Ctrl+C或关闭事件作处理. 处理方法 在.net平台下C ...

  8. centos升级openssh的两种方式

    此文介绍的是服务器在有网络和无网络情况下升级openssh方式. 一.首先介绍一个无网络如何升级: 1.准备相关的包 openssh下载地址:  http://mirror.internode.on. ...

  9. 使用开源软件sentry来收集日志

    原文地址:http://luxuryzh.iteye.com/blog/1980364 对于一个已经上线的系统,存在未知的bug或者运行时发生异常是很常见的事情,随之而来的几点需求产生了: 1.系统发 ...

  10. Hat's Fibonacci(大数问题)

    #include <iostream>#include <stdio.h>#include <string.h>using namespace std;int a[ ...