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

Over Complicating Thread List Template Change?

Discussion in 'XenForo Development Discussions' started by Snog, Jul 26, 2013.

  1. Snog

    Snog Well-Known Member

    I'm working on a mod that requires the thread_list_item template to be changed in a specific forum.

    The only way I can think of to accomplish this, is by extending the XenForo_ControllerPublic_Forum class, checking forumId in my class and then switching the whole forum_view template to a new template.

    This works fine, but it seems as though that's over complicating what should be a simple process of just changing the thread_list_item template.

    Does anyone have any suggestions or ideas?
  2. EQnoble

    EQnoble Well-Known Member

    Give me an example snippet of what you want changed in the thread_list_item template and I will test something out for you really quick.
  3. Snog

    Snog Well-Known Member

    It's nothing spectacular...

    The avatar image changes to an image that will be contained in the thread table.

    And items are added to the secondRow div in the template. Those items will also be contained in the thread table.

    I would think there should be a way to simply say if the template is thread_list_item then switch to template thread_list_item_two but for the life of me I can't find it. ;)
  4. Jeremy

    Jeremy Well-Known Member

    Use Conditionals the check if you are in your specific node, and if it is, use xen:include and include your new template.
  5. Snog

    Snog Well-Known Member

    If you're saying to edit the thread_list_item template. In my opinion that's not a good idea. It makes core system upgrades more difficult.
  6. Jeremy

    Jeremy Well-Known Member

    Snog and Chris D like this.
  7. Snog

    Snog Well-Known Member

  8. Brogan

    Brogan XenForo Moderator Staff Member

    As you're creating an add-on, use the TM system in 1.2 to modify the template.

    Again though, anyone wanting to install it will need to be running 1.2.
  9. Snog

    Snog Well-Known Member

    The Template Modifications System works perfectly in 1.2. I like it. :D

    I just wish there was a simple way to switch templates in earlier versions without editing the template.
  10. Snog

    Snog Well-Known Member

    LOL, talk about over complicating.

    I can do what I want with a single listener. There's no need to extend the controller class.

Share This Page