Smarty has several different types of variables. The type of the variable
depends on what symbol it is prefixed or enclosed within.
Variables in Smarty can be either displayed directly or used as arguments
for functionattributes and
modifiers, inside conditional expressions,
etc. To print a variable, simply enclose it in the
delimiters so that it
is the only thing contained between them. Examples:
Variables that are
assigned from PHP are referenced by preceding them with
a dollar sign $. Variables assigned from within a
template with the {assign}
function are also displayed this way.
Hello {$firstname} {$lastname}, glad to see you can make it.
<br />
{* this will not work as $vars are case sensitive *}
This weeks meeting is in {$meetingplace}.
{* this will work *}
This weeks meeting is in {$meetingPlace}.
This will output:
Hello Doug Evans, glad to see you can make it.
<br />
This weeks meeting is in .
This weeks meeting is in New York.
Associative arrays
You can also reference associative array variables that are
assigned from PHP by specifying the key after the '.' (period)
symbol.
Example 4-2. accessing associative array variables