• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Variable from ControllerPublic to template

A

account8226

Guest
#1
Hello,

I am trying to send out a variable I have in ControllerPublic (actionIndex) to a template I made.

How can I do this ?

Between, have you got any good xenforo tuts to starts developing add-ons ?

Regards.
 

James

Well-known member
#2
Have you returned a response? In the controller, you'll pass something like:
PHP:
return $this->responseView('XenForo_ViewPublic_Forum_View', 'forum_view', $viewParams);
Your $viewParams are the variables exposed to the template, where "forum_view" is your template.
 
A

account8226

Guest
#3
Have you returned a response? In the controller, you'll pass something like:
PHP:
return $this->responseView('XenForo_ViewPublic_Forum_View', 'forum_view', $viewParams);
Your $viewParams are the variables exposed to the template, where "forum_view" is your template.
Yes I did, here is my view params :
Code:
$viewParams = array(
                '1' => "Hey",
                'id' => $var
            );