{assign} — is used for assigning template variables during the execution of a template.
Using function:<?php
assign(mixed $value, string $var)
{assign 'test string' myVar}
Variable contains: {$myVar}
The above example will output:
Variable contains: test string
{assign name="myVar" value="test string"}
Variable contains: {$myVar}
The above example will output:
Variable contains: test string
{$name="Bob"}
What is your name?
My name is {$name}.
The above example will output:
What is your name?
My name is Bob.
{assign var=running_total value=$running_total+$some_array[$row].some_value}
Variable contains: {$running_total}
OR
{assign var=amount value=((10+20)/2)}
Variable contains: {$amount}
OR
{assign ((10+20)/2) amount}
Variable contains: {$amount}
OR
{$amount=((10+20)/2)}
Variable contains: {$amount}