Home >CMS Tutorial >PHPCMS >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} <a id="flash{$n}" href="{$v[url]}" target="_blank"><img src="{thumb($v[thumb],110,0)}"/></a> {/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} <a id="flash{$i}" href="{$v[url]}" target="_blank"><img src="{thumb($v[thumb],110,0)}"/></a> {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!