Template.assign var
From phpBB Development Wiki
template::assign_var –– Assign a single variable to a single key to the template object.
Contents |
Description
bool template::assign_var ( string $varname , mixed $varval )
This method is identical to the template::assign_vars method, except that this method assigns only a single variable to a single key.
- Note: When assigning more than a single template variable in a file, it is preferred to use the template::assign_vars method. As a general rule, template::assign_var should only be used if a single template variable needs to be assigned from within a function or the entire file.
Parameters
| Parameter | Usage |
|---|---|
| varname | Key to assign to the template. |
| varval | Variable assigned to the key |
Return Values
Returns true
Examples
Example #1
Variable assigned to the template object in your PHP file. (PHP Controller file)
$template->assign_var('S_SOME_VARIABLE', $some_variable);
Example of usage of this variable within the HTML template:
<div>{SOME_VARIABLE}</div>
See Also

