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

How to write self-increment in phpcms

angryTom
Release: 2020-02-15 15:07:19
Original
2237 people have browsed it

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}
Copy after login

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}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Issues
How to uninstall phpcms
From 1970-01-01 08:00:00
0
0
0
phpcms cannot be installed
From 1970-01-01 08:00:00
0
0
0
phpcms access address does not exist
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template