This example describes the use of thinkphp file references and branching structures. Share to everyone for your reference. The specific analysis is as follows:
First, import CSS and JS files
1, CSS Link:
Copy Code code as follows:
<link rel= ' stylesheet ' type= ' text/css ' href= ' __public__/css/test.css '
JS SRC:
Copy Code code as follows:
<script src= ' __public__/js/test.js ' ></script>
2. Import
Copy Code code as follows:
<import type= ' js ' file= ' js.test '/>//Import the Test.js file in the JS directory below the public folder, the import tag can omit the type attribute, and the default is JS
<import type= ' css ' file= ' css.test '/>//default is public folder
You can change the default folder settings BasePath properties
<import type= ' js ' file= ' js.my ' basepath= './other '/>
3. Load
Copy Code code as follows:
method to automatically detect an imported file type
<load href= ' __public__/js/test.js '/>
Second, the branch structure
1, if
Copy Code code as follows:
<if condition= ' $sex eq ' man ' >
Men are made of mud.
<else/>
Women are made of water.
</if>
<if condition= ' $age lt ' >
Minor
<elseif condition= ' $age eq '/>
Age
<else/>
Adult
</if>
Add:
> GT
< LTLT
= = EQ
<= ELT
>= EGT
!= NEQ
= = = Heq
!== Nheq
2. Switch
Copy Code code as follows:
<switch name= ' number ' >//loop to remove the $ symbol from the variable
<case value= ' 1 ' > a monk fetching water to eat </case>
<case value= ' 2 ' > Two monk table water eat </case>
<case value= ' 3 ' > Three monks have no water to eat </case>
<default/> This is the default value
</switch>
I hope this article will be helpful to everyone's thinkphp framework program design.