Home > Article > CMS Tutorial > How to write self-increment in phpcms
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!