您现在的位置是:首页 > 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}
本文标签:
很赞哦! ()
相关教程
图文教程
织梦dedecms后台添加缩略图地址style变了怎么办
如果在上传缩略图时是输入的图片路径,而不是上传图片,在路径中会多出字符,这是官方为了过滤而设定的。比如:上传图片路径为:/style/image/c
DedeCMS电脑端列表和内容怎么跳转到对应移动端
移动端和PC的整合越来越多,实现一个后台管理PC、移动、微信等。如题,这个问题困扰了我和许多站长,摸索了一两天才发现dedecms默认的wap跳转正好可以拿来用。
织梦dedecms数据库类常用操作函数getone()、Execute()
常用的方法:1、执行一个非查询类型的SQL语句,如 insert 、create 、update 等 $rs = $db->ExecuteNoneQue
dedecms栏目怎么增加缩略图功能
此升级修改方法在VVsp 测试通过其他版本未测试原理基本相同请大家自行测试是否可行;栏目图片的添加或修改图片时在 (栏目管理>高级选项)里面就会自动出现栏目图片添加的选择点击选择图片弹出窗口内选择浏览上传就OK
相关源码
-
(PC+WAP)生活资讯百科新闻门户类pbootcms网站模板为生活资讯、百科门户类企业打造的高性能网站模板,基于PbootCMS开源内核开发,采用HTML5响应式架构,PC与手机端实时数据同步,覆盖全终端用户浏览场景。查看源码 -
帝国cms7.5奇闻异事末解之谜模板免费下载带数据本模板基于帝国CMS7.5系统开发,为神秘现象、未解之谜类主题网站设计。包含完整的PC端、移动端及百度MIP站同步生成功能,内置火车头采集规则模块,可快速采集目标站内容资源。整体设计风格神秘大气,符合主题定位。查看源码 -
(自适应响应式)WORDwps办公资源教程资讯网站模板下载基于PbootCMS内核开发的响应式网站模板,为办公教程、WPS技巧分享、职场技能培训等场景打造。模板内置标准化文档分类体系,支持图文/视频教程混合展示,满足现代办公知识传播需求。查看源码 -
响应式HTML5家居建材办公家具桌椅pbootcms模板为家居建材、办公家具企业打造的响应式网站模板,同时支持多行业快速适配通过替换文字图片即可转型为其他行业官网,大幅降低开发成本。查看源码 -
(自适应)WordPress二次元博客主题SakurairoSakurairo主题为二次元内容创作者设计,提供丰富的动漫风格元素和个性化的展示效果。该主题在原有Sakura主题基础上进行了功能增强,支持多种自定义设置,满足动漫爱好者建立个人博客的需求。查看源码 -
(自适应响应式)房产合同知识产权企业管理pbootcms模板下载本模板基于PbootCMS系统开发,为知识产权服务、法律咨询及企业合同管理等行业设计。采用严谨专业的布局风格,突出法律文书与知识产权服务行业特色,适合展示各类法律服务和知识产权相关内容。查看源码
| 分享笔记 (共有 篇笔记) |
