首页
开发手册
应用中心
工具
用户中心
Ease Template Variable Usage
English
中文简体
English
上一篇
下一篇
### Ease Template Variable Usage Ease Template The template variables defined in htm are all variable names with enlarged brackets. For example: {test}, variables can also use array form {user['name']} or object form {user->name}. When using et assignment in class and function, you need to specify variables. The setting method is: ```php $tpl->set_var('user',$user[name]); ``` Ease Template is for the convenience of development. Arrays, variables, and objects can be passed into the htm template. If you want to assign a variable group, you can use the following method. ```PHP $set_array = array(1=>'FoundPHP',2=>'Ease',3=>'Template'); $tpl->set_var( array( 'test' => 'test code', 'more' => $set_array ) ); ``` In order for you to have a deeper understanding, the convenient test code is provided below: test_1.php ```PHP 'SYSTN',2=>'Ease',3=>'Template'); $tpl->set_var( array( 'test'=>'test code', 'more'=>$more ) ); } //conventional variables $color = 'red'; //call method test(); $tpl->set_file('test_1'); $tpl->p(); ?> ``` view/test_1.htm ```html
this is {color}{test}
{v} ``` The method of this demonstration provides an array assignment to the htm template for cyclic display operation. You may not understand the usage of loops, it doesn't matter, please continue to read the following articles, I will tell you a faster, more convenient and even more personalized loop method.