Three ways to import CSS and JS files (Learn)
1.link mode (general)
<link rel= ' stylesheet ' type= ' text/css ' href= ' __public__/js/test.css/> <script src= ' __public__/js/test.js ' ></script>
Import the test.js file and Css in the Js directory under the public folder folder under the Test.css file
2.import
<import type= ' js ' file= ' js.test '/>// import Public folder under the JS directory Test.js file,import label can omit the type attribute, default is the public folder JS folder, and the default is the JS file.
<import type= ' css ' file= ' css.test '/>
You can change the default folder settings basepath Properties
<import type= ' js ' file= ' js.my ' basepath= './other '/>
3.load
method to automatically detect the imported file type
<load href= ' __public__/js/test.js '/>
<load href= ' __public__/css/test.css '/>
Two, branch structure
On the day before yesterday, if else and so on the template exist in the form of labels (emphasis)
1.if($age <18) {
Minor
}elseif ($age =18) {
Puberty
}else{
Adult
}
The code in the foreground template is as follows:
<if condition= ' $age lt ' >
Minor
<elseif condition= ' $age eq '/>
Rushmore
<else/>
Adult
</if>
parse: condition if Note the if is a double label, and else and elseif eq instead of equals, lt instead of less than because the template in the day before yesterday is not available = <
> GT//Greater than
< LT//less than
= = EQ//equal
<= ELT//equal less than
>= Egt//equal greater than
! = NEQ//not equal
= = = Heq// constant equal to the H Understanding for Chinese constant first letter better understanding, actually H is a very load of words, at will we do not write.
!== Nheq//no
In the same use of switch ,the value in name is the variable value in switch
<switch name= ' number ' >
<case value= ' 1 ' > a monk carrying water to eat </case>
<case value= ' 2 ' > two monks table water eating </case>
<case value= ' 3 ' > three monks have no water to eat </case>
<default/> Here is the default value
</switch>
Third, circular structure (emphasis)
1.for
The following for statement is equivalent to a for ($i =0; $i <10;1++) {$j ABC}
<table border= ' 1 ' width= ' >
<for start= ' 0 ' end= ' name= ' i ' step= ' 1 ' comparison= ' lt ' >
<tr><td>{$i}</td><td>abc</td></tr>
</for>
</table>
Analytical:1,Tart,EndNeedless to say, it is the starting value and the end value;namevalue defaults toI, hit the bottom of the$iyou can output the ordinal value of the output directly from the0Start2,Step is the meaning of the interval, the value of which is positive, then the number of++, the negative is a few--; 3,The value in comparison is forthe symbol of the second sentence in the statement, that is, less than the number;2.volist
<volist name= ' list ' id= ' V ' >
{$v .username}<br/>
</volist>
The volist loop outputs a list value from the background and then named vhere, using $v below . the name of the output corresponding to the value.
3.foreach
<foreach name= ' list ' item= ' V ' key= ' K ' >
{$k}-------{$v}<br/>
</foreach>
Foreach , except to save the array with item name, key is the value.
Iv. Special Labels
1. Compare Labels
EQ or equal equals
NEQ or notequal not equal to
GT Greater than
EGT greater than or equal to
LT is less than
ELT less than or equal to
Heq constant equals
Nheq not constant equals
2. Scope label
Inch
<in name= ' n ' value= ' 9,10,11,12 ' > in these numbers <else/> is not within the range of these numbers </in>
<notin name= ' n ' value= ' 9,10,11,12 ' > in these numbers <else/> is not within the range of these numbers </in >
Between
<notbetween name= ' n ' value= ' 1,10 ' >{$n} 1-10 between <else/>{ $n} not in From 1 to ten </between>
3.present (3-7 Understanding)
Label to determine if the template variable has been assigned a value,
<present name= ' m ' >m has assignment <else/>m not assigned value </present>
4.empty
The empty label determines whether the template variable is empty,
<empty name= ' n ' >n is null assigned <else/>n value </empty>
5.defined
Determines whether a constant is defined and returns the contents of it successfully
<defined name= "name" >name constants already defined </defined>
6.define
Defining Constants in Templates
<define name= "variable name" value= "value"/>
7.assign
Variable Assignment in templates
<assign name= "var" value= "123"/>
V. Use of other labels
1, in the template directly using PHP code , in the template between <php></php> can be directly written PHP Code
<php> echo "can write php code directly" </php>