How do I - Template from controller

Marc

Well-known member
Need some help pls guys. Sorry if this is a stupid question, however I'm lost :(

Example:
PHP:
class somePlace_ControllerPublic_Index extends XenForo_ControllerPublic_Abstract
{
    public function actionIndex()
    {
      $text = "This is a shiny page";
      foreach ($whatever as $loopie)
{
        $shinyStuff = $loopie;
        $text .=  "blah blah ".$shinyStuff;
}
        $viewParams = array(
            'text' => $text,
        );

        return $this->responseView('somePlace_ViewPublic_Index', 'somePlace_Index', $viewParams);
    }

}

OK my question is simple really. I am completely lost as to how to template the above with the variables. Im sure this is simple as most things tend to be in xenforo, but just cant get my head around it.
 
I could be mistaken but your viewParams are your variables. You have 'text' in there as an array key, and $text as an array value.

You should be able to use {xen:raw $text} or {$text} inside your somePlace_Index template.
 
Ahhhhhh I have myself so confused. You are quite right :) its the {xen:raw $text} ...

and to make it worse, I'd already done it... Just spent that long working yesterday forgot what I'd done and what I hadnt. Dont tend to remember things when you are going through tutorials rather than figuring it out yourself unfortunatly LOL .....

Thankyou for your help AGAIN James :)
 
Top Bottom