Jump to content

Assign smarty variable from array


Rhobur

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...