search
HomeCMS TutorialDEDECMSHow to use DedeCms autoindex and itemindex

How to use DedeCms autoindex and itemindex

How to use DedeCms autoindex and itemindex?

autoindex/itemindex can use @me 1; to implement starting from the specified number. The following is a detailed introduction to the specific usage of the two. Interested friends can refer to

Recommended learning: Dream Weaver cms

The code is as follows:

<span style="color: rgb(51, 51, 51); font-family: 宋体, arial, helvetica, sans-serif; font-size: 14px; line-height: 26px; "></span>

How to make dedecms autoindex, itemindex start from 0 to 1

The code is as follows:

[field:global name=autoindex runphp="yes"]@me=@me+1;[/field:global] 
{dede:global name=itemindex runphp="yes"}@me=@me+1;{/dede:global}

autoindex itemindex usage experience difference

channelartlist 标签下使用 {dede:global name=&#39;itemindex&#39; runphp=&#39;yes&#39;}@me;{/dede:global}

increase by 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=&#39;yes&#39;}@me=@me-1;{/dede:global} 
<div id="h_pd_lm_{dede:global.itemindex/}" {dede:global name=&#39;itemindex&#39; runphp=&#39;yes&#39;}@me=(@me==1)?&#39;&#39;:&#39;style="display:none;"&#39;;{/dede:global} class="pd2_lmc_l1">

channelartlist example

The code is as follows:

{dede:channelartlist notypeid=&#39;123,124,146,147&#39;} 
<a class="pd2_lmt{dede:global name=itemindex runphp=&#39;yes&#39;}@me=(@me==1)?&#39;1&#39;:&#39;3&#39;;{/dede:global}"onmouseover="showitem2({dede:global name=itemindex runphp=&#39;yes&#39;}@me=@me-1;{/dede:global},&#39;pd_lm&#39;,&#39;h_pd_lm_&#39;,&#39;pd2_lmt&#39;);" href=&#39;{dede:field name=&#39;typeurl&#39;/}&#39;> 
{dede:php}if($refObj->Fields[&#39;ispart&#39;]){echo $refObj->Fields[&#39;typename&#39;];}{/dede:php} 
</a> 
{/dede:channelartlist}

Under the label Use [field:global name=autoindex/]

channel instance

The code is as follows:

{dede:channel titlelen=&#39;32&#39;} 
<li [field:global name=&#39;autoindex&#39;runphp=&#39;yes&#39;]if(@me%2==0){@me=&#39;class="rr"&#39;;}else{@me=&#39;&#39;;}[/field:global] ><h3 id="a-nbsp-href-field-typelink-field-typename-a"><a href=&#39;[field:typelink/]&#39;>[field:typename/]</a></h3></li> 
{/dede:channel}

Use this method when using autoindex runphp in arclist:

The code is as follows:

{dede:arclist titlelen=&#39;22&#39; row=&#39;4&#39; flag=&#39;c&#39; orderby=&#39;id&#39;} 
<a href="[field:arcurl /]" target="_blank">[field:title /]</a> 
[field:global name=&#39;autoindex&#39; runphp=&#39;yes&#39;]if(@me==2){@me="
";}else{@me=&#39; &#39;;}[/field:global]{/dede:arclist}

increment by 1

[field:global.autoindex/]

arclist instance

The code is as follows:

{dede:arclist channelid=17 row=6 orderby=pubdate titlelen=40 addfields=&#39;docphoto,docjob,doctec&#39;typeid=&#39;123,136,146,155,172,182,202&#39;} 
<div id="h_nrr_zj_[field:global.autoindex/]"class="nrr_zjl" [field:global name=&#39;autoindex&#39;runphp=&#39;yes&#39;]if(@me==1){@me="";}else{@me=&#39;style="display:none;"&#39;;}[/field:global] > 
<div><a href="[field:arcurl/]" title="[field:fulltitle/]" target="_blank"><img src="/static/imghwm/default1.png"  data-src="[field:litpic/]"  class="lazy"  alt="[field:fulltitle/]" /></a></div> 
</div> 
{/dede:arclist}

How to freely define the starting number

autoindex/itemindex You can use @me 1; to start from the specified number

When you encounter similar problems, take this note and you can use it flexibly!

Try autoindex under the list tag

The code is as follows:

{dede:list pagesize=&#39;40&#39; orderby=&#39;id&#39;} 
[field:global name=&#39;autoindex&#39; runphp=&#39;yes&#39;]if(@me%10==0){@me="test";}else{@me=&#39;&#39;;}[/field:global] 
{/dede:list}

Use custom functions for autoindex/itemindex

First add/extend.fun.php Add a custom function

The code is as follows:

function MyPosition($p){ 
$positionArr=array(275,330,380,435,495,547); 
return $positionArr[$p];

Then add

the code is as follows:

{dede:channel type=&#39;son&#39; typeid=&#39;13&#39; row=&#39;6&#39; noself=&#39;yes&#39;} 
<!-----侧栏菜单------------------> 
<div id=&#39;pdv_16795&#39; class=&#39;pdv_class&#39; title=&#39;&#39; style="width:71px;height:20px;top:[field:global.autoindex function=&#39;MyPosition(@me)&#39;/]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}
in the template

The above is the detailed content of How to use DedeCms autoindex and itemindex. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.