|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
IT_Services Smarty Rookie
Joined: 30 Sep 2013 Posts: 9
|
Posted: Mon Sep 30, 2013 7:01 am Post subject: Append array and access as nested array |
|
|
Hi,
I want to dynamically add key-value-arrays to a variable and access them in the template like this:
{$User.IsAuthenticated}
{$User.DisplayName}
In my code the variable should be filled on different places:
$Template->append('User' => array('IsAuthenticated' => $Authentication->IsUserAuthenticated()));
...
$Template->append('User.AllowThis', false);
...
$Template->append('User.AllowThat', true);
But I don't know how to assign/append the values, that I can access them in the template like the way I want.
Regards
Florian |
|
Back to top |
|
IT_Services Smarty Rookie
Joined: 30 Sep 2013 Posts: 9
|
Posted: Mon Sep 30, 2013 12:17 pm Post subject: |
|
|
Solution found:
The append-function offers a 3rd parameter ("merge") - set to true I get the expected result |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|