assign

1.0 1.1 1.2 1.3

Assigns a value to a variable

<?php
assign(mixed $value, string $var)
  • value: the value that you want to save
  • var: the variable name (without the leading $)

Examples

Example #1

index.tpl
{assign 'test string' myVar}
Variable contains: {$myVar}

The above example will output:

Variable contains: test string

Note that this plugin was mostly provided for smarty compatibility, it is easier to do it with the = operator, just as in any language, using :

index.tpl
{$myVar='test string'}