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

How do I - Template from controller

Discussion in 'XenForo Development Discussions' started by Marc, May 23, 2011.

  1. Marc

    Marc Well-Known Member

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

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


    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.
  2. James

    James Well-Known Member

    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.
    Marc likes this.
  3. Marc

    Marc Well-Known Member

    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 :)
    James likes this.

Share This Page