DiegoP.
DiegoP.

Reputation: 45737

Smarty Associative array

I do not understand how to assign the correct name here with Smarty.

If I try to do so it does not get recognized:

 $smarty->assign('lang[\'city\']', $lang['city']);

It does not assign anything...

Can you help me out?

$lang is an associative array, like $lang = array('city'=>'Here', 'name'=>'Steve');

Upvotes: 0

Views: 3176

Answers (1)

Vyktor
Vyktor

Reputation: 20997

According to smarty documentation you should use:

$smarty->assign( 'lang', $lang);

And in template:

{$lang.city}

Upvotes: 4

Related Questions