Rhobur Posted May 9, 2016 Share Posted May 9, 2016 Hi, Is it possible to dynamically assign smarty variables from an array? Like for ($i=0; $i < $varSmart; $i++) { $this->context->smarty->assign($varsList[$i],$varSmart[$i]); } I am trying that in a module and nothing get assigned. Robert Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2016 Share Posted May 9, 2016 if $varsList[$i] will be a string that you will use as a name of variable - it should be possible 1 Link to comment Share on other sites More sharing options...
Rhobur Posted May 9, 2016 Author Share Posted May 9, 2016 Yes, is a string, that is why I assumed it'll work but it doesn't, it is not assigned :puzzled: Of course, if $varsList[$i] is "blabla" and $varSmart[$i] is a single array, the assign works. But if $varsList[$i] is an array of strings and $varSmart[$i] is an array of arrays, it doesn't. The problem is that I need a lot of variables and assigning them in an array by hand is out of the questions. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now