Jump to content

[SOLVED] Can't assign smarty variable


Rhobur

Recommended Posts

Hi,

I have a controller file in a module.

Inside it I have a public function which ends with return $name, where $name is an array.

I another protected function I am trying to assign this array to a variable by $var = method()

Then I have $this->context->smarty->assign('variable',$var)

The problem is that in the tpl the $variable is null.

What is puzzling (at least to me) is that even trying to assign a simple string like $this->context->smarty->assign('variable','test') from the same protected function doesn't produce any effect.

Still the string assign works if called in the initContent function of the controller.

The smarty $variable does not appear on debug.

Any ideas, please?

 

PS I am able to assign it by passing the return value of my public function to a variable in the initContent controller function and then assign it it smarty.

      However I wonder why I can't assign this same return value from another  function in the controller?

Edited by Rho_bur
Forgot about that (see edit history)
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...