您现在的位置是:首页 > cms教程 > DedeCMS教程DedeCMS教程

织梦cms自增数使用方法实例代码

尤政航2023-09-23DedeCMS教程已有人查阅

导读[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global]{dede:glob

[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}
自增数
arclist 标签下使用 [field:global.autoindex/] 默认从1开始
channel 标签下使用 [field:global.autoindex/] 默认从0开始
channelartlist 标签下使用 {dede:global.itemindex/} 默认从1开始
自定义 :[field:global name=autoindex runphp="yes"]@me=@me+4;[/field:global]  从5开始
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}

本文标签:

很赞哦! ()

相关源码

  • HTML5响应式健身俱乐部pbootcms网站模板下载为健身俱乐部、瑜伽中心及运动场馆设计的响应式网站模板,采用PbootCMS内核开发,支持一键替换图文适配健身器材销售、瑜伽工作室等多类型运动健康产业。查看源码
  • (自适应响应式)黑色酷炫高端数码摄影pbootcms网站模板源码本模板基于PbootCMS开发,为摄影工作室、个人摄影师及摄影爱好者设计。采用深色系风格,突出摄影作品展示效果,适配各类数码设备浏览。适用于作品集展示查看源码
  • (自适应响应式)门窗定制门业带视频功能pbootcms模板下载本模板采用PbootCMS内核开发,为门窗制造、定制安装企业打造,通过可视化后台管理系统快速构建品牌官网。自适应设计确保在手机、平板、电脑等设备上均能获得优质浏览体验查看源码
  • (自适应)WordPress主题SEO自媒体博客资讯模板RabbitV2.0Rabbit v2.0主题专注于网站搜索引擎优化需求,为博客、自媒体及资讯类网站提供专业的SEO技术解决方案。该主题从架构设计到功能实现均围绕搜索引擎优化理念展开。查看源码
  • (PC+WAP)蓝色自动电动闸门伸缩门类网站pbootcms模板下载为电动闸门、自动伸缩门企业设计的响应式网站模板,突出产品展示与技术优势,助力门控设备企业建立专业数字化形象。手工编写DIV+CSS结构,代码精简高效,无冗余代码干扰,加载速度更快。查看源码
  • (PC+WAP)蓝色低碳环保隔断板装修装饰类网站pbootcms源码下载本款基于PbootCMS开发的网站模板为活动隔断板、装修装饰行业打造,特别适合移动隔断、环保隔断、办公分区等产品的展示与推广。查看源码
分享笔记 (共有 篇笔记)
验证码:

本栏推荐