Jump to content

Assign variable from a controller to tpl file


beginner1

Recommended Posts

Hi everyone, I have created a front-office controller in which I have set up a tpl file as template. I want to assign a variable such that it can be used in the tpl file through smarty. The variable should be assigned in the front-office controller. I have tried the following statements but they don't work.

 

$this->context->smarty->assign('my_var', $results);              // this works in the module.php file but not in the controller file
$smarty->assign('my_var', $length);
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...