Smarty Manual
Prev |  | Next

# assign

assign --

##

void assign ( mixed var)
void assign ( string varname, mixed var)

This is used to assign values to the templates. You can explicitly pass name/value pairs, or associative arrays containing the name/value pairs.

Example 1. assign
`<?php // passing name/value pairs $smarty->assign('Name', 'Fred'); $smarty->assign('Address', $address); // passing an associative array $smarty->assign(array("city" => "Lincoln", "state" => "Nebraska")); ?>`

Prev | Home | Next
append_by_ref | Up | assign_by_ref