JavaScript is disabled!

{var}

The {var} function assigns values to template variables in a more intuitive and brief manner than Smarty's default {assign} function. Values can be assigned to multiple variables in one {var} statement.

Parameters

At least one var=value declaration, where value is assigned to $var (what a surprise!).

Examples

{var welcome="Hello world!" foo="bar"}
{$welcome}<br>
foo = {$foo}

This will render as:

Hello world!<br>
foo = bar

Downloads

function.var.php (855 bytes)

Installation

Save the downloaded PHP file as function.var.php in your Smarty plugins directory (this is usually the smarty/plugins/ folder).

Versions