Reputation: 197
I would like to assign a value to multidimentional array with Smarty.
To assign value to a variable, I use below code.
{assign='data1', value='this is data'}
I have a variable, $cart[products]
and would like to assign a value to that variable.
I have tried using {assign='cart.products', value='this is data'}
but the data doesn't enter the variable.
Can anybody help me to solve this problem?
Upvotes: 0
Views: 2228
Reputation: 500
You should change the value into an array.
{assign var=carts value=['products'=>'this is data']}
It is explained well in http://www.smarty.net/docs/en/language.syntax.variables.tpl.
Upvotes: 1