Template.assign vars

template::assign_vars –– Assign key variable pairs from an array to the template object.

Description
While language and template variables are automatically set, you will need to manually set other kinds of data you want to use in your template file. This is done by using the template object's assign_vars method.
 * 1) bool template::assign_vars ( array $vararray )


 * Note: The means of transporting data to the template is the use of template variables.. By convention, template variable names are always all-uppercase. Variables output to the user are enclosed in curly braces (e.g. {L_SOME_VARIABLE}) while variables in control structures are used directly.

Return Values
Returns true

Example #1
Variables assigned to the template object in your PHP file. (PHP Controller file) $template->assign_vars(array( 'S_SOME_VARIABLE'  => $some_variable, 'NOW'              => $user->format_date(time), ) );

Example of usage of these variables within the HTML template: {S_SOME_VARIABLE} {NOW}

Naming Conventions

 * The naming conventions for template variables are: * Template related variables are prefixed with "T_". These are usually pre-assigned by the phpBB3 core code. * Variables to be used in control structures or for form actions etc. are prefixed with "S_". * Variables containing URls are prefixed with "U_". * Language variables for output are called "L_LANGUAGE_KEY". Where "LANGUAGE_KEY is an existing language entry's key. These are assigned automatically. * Language variables for use in javascript are called "LA_LANGUAGE_KEY". Where "LANGUAGE_KEY is an existing language entry's key. These are assigned automatically. * Values for display are not prefixed.

Language Variables

 * Language variables are automatically assigned. You can use them from the template by prefixing their name with 'L_' in the HTML template file: {L_EXAMPLE_LANG_VAR}