Original: Thinkphp Getting started three-frame templates, variables (47)
"Call template on Controller"
Display () a template that invokes the name of the current operation
Display (' name ') invokes the template file of the specified name
Controller call template Four ways:
"Passing variables to the template in the controller"
Passing variable information to a template inside Smarty
$smarty-Assign (variable name, value);
Within the TP frame the same applies to assign () passing variable information to the template
Thinkphp the left and right tags of the template engine:
thinkphp/lib/behavior/parsetemplatebehavior.class.php
Modify the TP template engine tag
Modify the template engine to Smarty
1 pass variable information to the template in two ways:
$this-Assign (name, value);
$this, name = value;
You can modify the left and right marks of the TP template engine
We can modify the template engine to Smarty
2 Output common variable information in template
3 output array element information inside the template
1 {$hobby [table below]}
2 {$hobby. The following table}
Output object's property information inside the template
{$ucenter Property name}
{$ucenter: Property name}
"Traversing Array Information"
Two methods:
foreach and volist can be nested traversal, the deepest level is 3 layers.
foreach (parameter 1, parameter 2, parameter 3)
Volist (parameter 1 parameter 2 parameter 3)
Name: template array variable names
ID: traversed element information
Key: element below table information (key i)
Offset: Output array offset
Length: Shows the number of output elements
MoD: For the specified number, modulo
Empty: array Specifies information for NULL transport
"Normal for loop output"
Lt:less than less than <
Gt:great than greater than
Eq:equal equals
Elt:less equal less than or equal to
Egt:great equal greater than or equal to
Heq:heng equal constant equals
Nheq:not Heng equal not constant equals
"Conditional judgment Structure"
If judgment
Two-way branch:
Multi-Channel Branch:
"Scope judgment"
In between
inch Label Use
between Label Use
Range Label Use ( in and between integrated tabs )
"Constant equals"
Thinkphp Getting started three-frame templates, variables (47)