Thinkphp entry 3-framework template, variable (47), thinkphp47
[In the Controller call TEMPLATE]
Display () call the template of the current operation name
Display ('name') calls the template file with the specified name
Controller call template:
[Pass variables to the template in the Controller]
Pass variable information to the template in smarty
$ Smarty-> assign (variable name, value );
In the tp framework, assign () is also used to pass variable information to the template.
Left and right marks of ThinkPHP template engine:
ThinkPHP/Lib/Behavior/ParseTemplateBehavior. class. php
Modify the TP template engine tag
1. Two ways to pass variable information to the template:
$ This-> assign (name, value );
$ This-> name = value;
2. Output common variable information in the template
3. Output array element information in the template
1 {$ holobby [Table below]}
2 {$ holobby. Table below}
Output the property information of the object in the template.
{$ Ucenter-> attribute name}
{$ Ucenter: property name}
[Traverse array information]
Two methods:
Foreach and volist can be nested for traversal, with the deepest layer being three layers.
Foreach (parameter 1 parameter 2 parameter 3)
[General for loop output]
Lt: less than <
Gt: great than is greater
Eq: equal equals
Elt: less than or equal to less
Egt: great equal greater than or equal
Heq: heng equal constant equals
Nheq: not heng equal is not always equal
[Condition judgment structure]
If judgment
Dual Branch:
[Range Judgment]
In
InLabel usage
[Constant equals]