超全织梦dedecms autoindex和itemindex标签的使用介绍

180

让dedecms autoindex,itemindex 从0到1开始的办法
 
代码如下:
 
[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global]
{wmd:global name=itemindex runphp="yes"}@me=@me+1;{/wmd:global}
 
autoindex itemindex 的使用心得区别
 
channelartlist 标签下使用 {wmd:global name='itemindex' runphp='yes'}@me;{/wmd:global}
自增1
arclist 标签下使用 [field:global.autoindex/] 默认从1开始
channel 标签下使用 [field:global.autoindex/] 默认从0开始
channelartlist 标签下使用 {wmd: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开始
 
{wmd:global name=itemindex runphp='yes'}@me=@me-1;{/wmd:global}

<div id="h_pd_lm_{wmd:global.itemindex/}" {wmd:global name='itemindex' runphp='yes'}@me=(@me==1)?'':'style="display:none;"';{/wmd:global} class="pd2_lmc_l1">
 
channelartlist实例
 
代码如下:
 
{wmd:channelartlist notypeid='123,124,146,147'}
<a class="pd2_lmt{wmd:global name=itemindex runphp='yes'}@me=(@me==1)?'1':'3';{/wmd:global}"onmouseover="showitem2({wmd:global name=itemindex runphp='yes'}@me=@me-1;{/wmd:global},'pd_lm','h_pd_lm_','pd2_lmt');" href='{wmd:field name='typeurl'/}'>
{wmd:php}if($refObj->Fields['ispart']){echo $refObj->Fields['typename'];}{/wmd:php}
</a>
{/wmd:channelartlist}
 
标签下使用 
 
[field:global name=autoindex/]
 
channel实例
 
代码如下:
 
{wmd: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>
{/wmd:channel}
 
在arclist中使用autoindex runphp 时用这种方式:
 
代码如下:
 
{wmd: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]{/wmd:arclist}
 
自增1
 
[field:global.autoindex/]
 
arclist实例
 
代码如下:
 
{wmd: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>
{/wmd:arclist}
 
如何自由定义 开始的数字
 
autoindex/itemindex 可以使用 @me+1;实现由指定数字开始
遇到类似的问题做下这个笔记,在用到的时候可以灵活发挥!
 
list 标签下试用autoindex
 
代码如下:
 
{wmd:list pagesize='40' orderby='id'}
[field:global name='autoindex' runphp='yes']if(@me%10==0){@me="test";}else{@me='';}[/field:global]
{/wmd:list}
 
对autoindex/itemindex使用自定义函数
 
先在include/extend.fun.php里添加自定义函数
 
代码如下:
 
function MyPosition($p){
$positionArr=array(275,330,380,435,495,547);
return $positionArr[$p];
 
然后在模板里添加
 
代码如下:
 
{wmd: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>
{/wmd:channel}

The End

相关推荐

织梦dedecms生成报错Fatal error: Allowed memory size of in /include
织梦生成静态html页面时报错:Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /wwwroot/include/helpers/string.helper.php on line 121 字面意思理解是内存不足,很多朋友可能认为是内存不足问题,实际上不...
2023-10-13 dedecms安装使用
329

织梦Dedecms限制栏目列表生成的页数
有时候我们的文档特别的多,另外也是为防止网站被采集,全站文章被索引,所以要控制下织梦dedecms列表页面数量。 这样的话我们要具体怎么操作呢? 1、首先建立一个全局变量: 在系统-站点设置中添加一个新的变量,变量名称:cfg_listmaxpage,变量说明:栏目...
2023-05-24 dedecms安装使用
126

dedecms织梦全局变量调用方法总结
dedecms织梦的全局变量可以在/include/common.inc.php文件中看到,此文件内定义了大量的全局变量,详细自己去看看。 如果我们要实用dedeCMS织梦全局变量该如何调用: 第一种单独调用: {wmd:global.变量名 /},注意闭合,否则会以文本形式输出。这种一般适用...
2023-03-01 dedecms安装使用
238

织梦DEDECMS 栏目文章文章命名规则修改
织梦DEDECMS 栏目文章文章命名规则修改, 每次添加栏目的时候 都要改文章命名规则,十分麻烦, 修改下面这个地方就可以一改永亦,织梦模板网为您解答 找到\include\common.inc.php 搜索 $cfg_df_namerule 把: $cfg_df_namerule = {typedir}/{Y}/{M}{D}/{aid...
2021-09-24 dedecms安装使用
165

解决dedecms织梦系统{wmd:arclist keyword='动态获取关键词'}只生效一次
当我们通过{wmd:arclist keyword=关键词}来调用文章列表时,你会发现只在其中一个栏目里生效,在其他栏目,仍然显示上一次的关键词。 原因是由于arclist的缓存导致的。 只需修改/include/taglib/arclist.lib.php文件,大概在384行: $taghash = md5(seriali...
2021-09-24 dedecms安装使用
212

织梦dedecms数据库内容替换安全确认码怎么去掉
我们在使用织梦dedecms数据库内容替换时候,经常遇到 安全码 显示的无法识别或者不清晰,这个安全码的位置是在核心 - 批量维护 - 数据库内容替换,如果识别不了,这个页面还没有改变验证码的地方,只能重新刷新页面,如果我们不想要这个安全码的话,要怎么操...
2021-09-24 dedecms安装使用
109