In phpcms, loops are used a lot, generally in two forms.
The form is as follows:
Form one:
{loop $data $a} {$a} {/loop}
Form two:
{loop $data $a $b} {$a}---{$b} {/loop}
The difference is as follows:
First of all, $data is an array. In the first form, the $data array is like this, "aa", "bb", "cc". In this form, To get the first value aa, we use this code $data[0], to get the second value we use $data[1], and so on.
Form 2, the $data array has an additional key value, which is in this form "a1=>aa", "a2=>bb", "a3=>cc", a1, a2 , a3 is called the key value of $data. If we want to take out the variable value with the key value a1, that is, aa, we can use $data[a1] to get aa. Similarly, $data[a2] also It’s just bb.
Then in PHPCMS, form 1:
In the loop, $a is $data[0], $data[1], $data[2], we directly write {$ a} can loop to get the value of $a.
Form 2:
In the loop, $a is a1, a2, a3 in the above example, and $b is aa, bb, cc in the above example.
The examples are as follows:
Example 1: There are three values "aa", "bb", "cc" in the
$data array, then :
{loop $data $a} {$a} {/loop}
will output aa, bb, cc.
Example 2:
There are three key values in the $data array: "a1=>aa", "a2=>bb", "a3=>cc", Then
{loop $data $a $b} {$a}-{$b}| {/loop}
will output a1-aa|a2-bb|a3-cc|.
Related tutorial recommendations: phpcms tutorial
The above is the detailed content of How to use loop tag in phpcms. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
