Let's start with the commonly used labels and variable output in the template.
I. variables:
For example, we defined a variable in the PHP file and assigned a value, for example:
$ Siteurl = 'HTTP: // www.demi.cn ';
$ Sitename = 'successful website construction by Zhu Jun ';
So how can I output it in the template? In fact, this is very simple:
Site address: $ siteurl
Site name: $ sitename
The output result is as follows:
Site address:Http://www.demi.cn
Site name: Zhu Jun succeeded in website construction
Ii. Labels
The uchome template generally contains the following tags:
If tag, else tag, loop tag, EVAl label
1. The if tag and else Tag mainly determine the tag. The format is as follows:
<! -{If condition}->
Output content
<! -{/If}->
And
<! -{If condition}->
Output content 1
<! -{Else}->
Output content 2
<! -{/If}->
The preceding conditions can be variables, valid PHP functions, and user-defined functions.
2. Loop tag
Loop labels are loop output arrays. If you do not understand arrays, please refer to relevant materials.
Format 1:
<! -{Loop $ S $ key $ value}->
$ Value
<! -{/Loop}->
Equivalent to PhPCodeMedium
Foreach ($ s as $ key => $ value ){
Echo $ Value
}
Format 2:
<! -{Loop $ S $ value}->
$ Value
<! -{/Loop}->
Equivalent to PHP code
Foreach ($ s as $ value ){
Echo $ Value
}
$ S must be a two-dimensional array.
3. EvAl label
EVThe Al tag is mainly used to execute PHP syntax in the template.After Al, you must keep up with valid PHP syntax, such:
<! -{EVAl echo 'this is the PHP syntax ';}->
Basically, there are several tags in the uchome template, which are also the most common ones.