If it's an array you should use the period symbol (in smarty 2 and up, at least):
{$member.name}
http://www.smarty.net/docsv2/en/language.variables.tpl#language.variables.assoc.arrays
but it may be different in the version you're using
Вопрос
I use Smarty v.1.6, in php :
$groups = $user_groups['data'];
$user_groups['data']
derived from $user_groups = $facebook->api('/'.$fbuser.'/groups');
(I retrieve user facebook group data and it returns an array). Then I assign $groups
in tpl file :
$template->assign("userGroupsData", $groups);
I want to print only the name of each group, so in tpl :
{foreach from=$userGroupsData item=member}
{$member->name}
{/foreach}
but the result shows nothing. {$member->name|@print_r}
will produce :
11111111111
(as the number of my group)
What's wrong with my code? Please help..
Here is the array result of {$member|print_r}
:
Array (
[name] => beasiswa dirmawa ugm
[unread] => 25
[bookmark_order] => 999999999
[id] => 148164981898119 ) 1
Array (
[name] => Diskusi Jurusan IKE
[unread] => 1
[bookmark_order] => 999999999
[id] => 131266600402713 ) 1
Array (
[name] => ILMU KOMPUTER - UGM
[unread] => 7
[bookmark_order] => 9
[id] => 392009304179631 ) 1
Array (
[name] => Facebook Developers
[unread] => 25
[bookmark_order] => 999999999
[id] => 146797922030397 ) 1
...etc
Any help would greatly appreciated, thank you.
Решение
If it's an array you should use the period symbol (in smarty 2 and up, at least):
{$member.name}
http://www.smarty.net/docsv2/en/language.variables.tpl#language.variables.assoc.arrays
but it may be different in the version you're using