Purpose
After the controller prepares data, it usually passes results to the view. PhpTide provides assign() for template variables.
Basic example
You can pass typical PHP values:
php
class index{
function demo (){
$str = 'PhpTide';
assign('name',$str);
v();
}
}Using variables in templates
In ./app/home/view/index/demo.html:
text
Hello,{$name}The first argument to assign is the variable name; the second is the value.
Template syntax
{$name} is built-in template syntax. Templates may also allow raw PHP depending on project conventions.
Typical uses
Strings, arrays, or query result lists can be prepared in the controller and passed to the template with assign().