Home >Backend Development >PHP Tutorial >Getting Started with Thinkphp Three—Framework Templates, Variables (47), thinkphp47_PHP Tutorial
display() calls the template of the current operation name
display(‘name’) calls the template file with the specified name
Four ways for controllers to call templates:
[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 tags of ThinkPHP’s template engine:
ThinkPHP/Lib/ Behavior/ ParseTemplateBehavior.class.php
Modify TP template engine tag
1 There are 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 {$hobby[list below]} 2 {$hobby.Table below} Output the attribute information of the object in the template
{$ucenter->property name} {$ucenter:property name} [Traverse array information]
Two methods: Foreach and volist can be nested traversal, the deepest level is 3 levels. foreach(parameter 1 parameter 2 parameter 3) [Normal for loop output]
lt:less than gt: great than > eq:equal is equal to elt:less equal Less than or equal egt: great equal greater than or equal to heq: heng equal is equal to nheq: not heng equal Not equal to [Conditional judgment structure]
if judgment Double branch: 【Range Judgment】
in between in tag using 【Constant equal】