Home  >  Article  >  CMS Tutorial  >  How to write self-increment in phpcms

How to write self-increment in phpcms

angryTom
angryTomOriginal
2020-02-15 15:07:191951browse

You can use the {php} tag to write auto-increment in phpcms. The specific method is to let the variable auto-increment in the {loop} tag.

How to write self-increment in phpcms

Self-increment from 1

{pc:content action="position" posid="1" num="5" thumb="1"}
    {loop $data $v}
        
    {/loop}
{/pc}

Start incrementing from the specified number (the example is starting from 2)

{pc:content action="position" posid="1" num="5" thumb="1"}
    {php $i=2;}
    {loop $data $v}
        
        {php $i++}
    {/loop}
{/pc}

Related recommendations: phpcms tutorial

The above is the detailed content of How to write self-increment in phpcms. 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