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

Add Template to Add-on

Discussion in 'XenForo Development Discussions' started by MichaelB, Aug 21, 2013.

  1. MichaelB

    MichaelB Member

    I'm using an unsupported add-on and am trying to figure out how to display some information on a new page node from that add-on, for private usage. The page node is to display information in a certain format but when I created a new page and copied the coding from one of this add-on's template to the page's template as a test, it didn't display any of the specific information.

    How would I go about doing this? I'm a bit stumped at the moment.
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    Is the page's controller using the new template for display?
  3. MichaelB

    MichaelB Member

    I copied the coding from one of the add-on's templates and put it into the page node's template. I added the add-on's ControllerPublic class and Method, or so I thought and I get the following error:

    Fatal error: Using $this when not in object context in -blocked out path- on line 122
    Very confused.
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    You aren't in a class and are attempting to write code as if its in a class.
  5. MichaelB

    MichaelB Member

    What would be the best method for me to pull the information to a page node template just as it is in the add-on's template?
  6. JulianD

    JulianD Well-Known Member

    If you're writing a static class, you can't use $this. If you can show us an example of your code, maybe we can help you better.
  7. MichaelB

    MichaelB Member

    I'm not writing a class. I'm just trying to display information that an add-on already does on one of its pages but on a page node. The add-on displays a list of everything with no filter options. I've already set it up to show only a certain thing but being as it is hard coded, it removes the rest. I don't want this so I'm looking to have a page node for each filter. The problem is having that information show up on a page node.

    So the question is...how do I port the information to a page node in addition to copying the template code into the page node's template?
  8. Jeremy

    Jeremy XenForo Moderator Staff Member

    Page nodes don't use template syntax. You'll have to use a callback.

Share This Page