Variables

A lot of what appears on a page isn't tied to the theme at all — it's content supplied by the module. Even a simple message like "Logged as admin" is independent of the theme itself. That's why theme variables exist: they let a .tpl file receive content from the module rendering it.

When you reference a theme variable, Smarty replaces it with the string the module provided. To use one:

{$variable_name}

Some variables are more complex — arrays. If you know the key a value is stored under, you can pull it out directly:

{$variable_name.key}

To loop through every entry in an array instead of pulling out a single key, see the next page, Smarty Functions.

You can use the same variable as many times as you need in a template.

To know which variables a .tpl file has available, you'll usually need to look at the default theme's copy of that file. For a deeper look, check the module's own source for calls like:

$theme->assign('variable_name', 'value');

Each assign() call defines one variable your template can use.