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

Controllers and Page Content

Discussion in 'XenForo Development Discussions' started by Tempest Gamers, Jul 5, 2013.

  1. Tempest Gamers

    Tempest Gamers New Member

    I have a very LARGE script I am trying to render in a page. When I made this for myself I did not need to return anything so the script was not fully php and all the html was not in variable, it was just rendered and cut to php where needed.

    However, with the controller and route system of adding pages it does not seem to act the same. All content is rendered above the site instead of where it was through the php callbacks.

    Do I REALLY need to go through and change this entire script into solid php or is there a way around this?
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    You may want to explore the {xen:callback template tag.

    http://xenforo.com/community/resources/xen-callback-tag.2027/

    It allows you to call a PHP script directly in the template. This may allow you to get it working but, of course, without knowing the ins and outs of your script it will be difficult to say.
     
  3. Tempest Gamers

    Tempest Gamers New Member

    Thats perfect, except that the template editor tells me "Line 2: Unknown tag: callback".
     
  4. Chris D

    Chris D XenForo Developer Staff Member

    Sorry, I forgot to add.

    It's a XenForo 1.2 feature. So you would need to try it out in the current XenForo 1.2 beta. Of course, it isn't recommended to use XenForo 1.2 for production sites, but it's quite a feasible option for the near future.
     
  5. Tempest Gamers

    Tempest Gamers New Member

    Ah, yeah then thats not really an option, my target with this addon is production and as much compatibility as I can provide. Is there another way to achieve this?
     
  6. Chris D

    Chris D XenForo Developer Staff Member

    Yep :)

    Probably this, unfortunately:
    My best estimate is that XenForo 1.2 final will likely be released at some point in July. (Assuming Beta 5 on Tuesday, RC 1 the following Tuesday and final the following Tuesday).

    I don't think it will take long for the bulk of XenForo users to be using 1.2 thereafter.

    It might be worth you downloading the beta, installing it locally and just seeing if the xen:callback produces the desired results or not. If it does, it might be worth doing.
     
  7. Tempest Gamers

    Tempest Gamers New Member

    Scratch that, found a better way,

    ob_start();
    $var=ob_get_clean();

    Thanks anyways!
     
    Chris D likes this.

Share This Page