Development Wiki

Template.assign var

From phpBB Development Wiki

Revision as of 21:59, 21 September 2008 by Highway of life (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

template::assign_var –– Assign a single variable to a single key to the template object.


  1. 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.


Parameter Usage
varname Key to assign to the template.
varval Variable assigned to the key

Return Values

Returns true


Example #1

Variable assigned to the template object in your PHP file. (PHP Controller file)


Example of usage of this variable within the HTML template:


See Also

  • template::assign_vars