How to add a variable to a Template?

tyteen4a03

Well-known member
From the controller.

Thanks for your response.
Code:
        $viewParams = array(
            'variable' => "things",
        );

        return $this->responseView('ViewClassName', 'template_name', $viewParams); // The View class does not have to exist unless you are not outputting HTML or want to customize the output (which is rarely necessary)
Then use {$variable} to access it in the template. If you passed an array you use the Lua array access syntax: {$variable.someThing.moreThings.myValue}
 
Top