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

Template Edits with Add-On

Discussion in 'XenForo Development Discussions' started by IFeelYourPain13, Jan 8, 2012.

  1. IFeelYourPain13

    IFeelYourPain13 Active Member

    How can I create template edits in my Add-On?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. IFeelYourPain13

    IFeelYourPain13 Active Member

    I doubt a template hook is available for Alerts. There wasn't in vbulletin either. I am trying to figure out how to get the template edits to be done by the add-on itself. With vbulletin it was quite simple, but not with XF. Any ideas on how to do a search for specific code and add code after it?

    Id like to be able to not have everyone do template edits.
    http://xenforo.com/community/threads/sound-notification-free.25605/#post-312688
     
  4. Robbo

    Robbo Well-Known Member

    The only real way to do it at the moment is a post template listener that manipulates the DOM. You can see this in my add-ons. XenTrader should show it. Annoying and has a performance hit in theory (could add some form of caching I guess) but the only way I have found to do it. In the future I am going to have documents so people can disable the listener doing it and explain to do the edits themselves if they see any performance drops.
     
  5. IFeelYourPain13

    IFeelYourPain13 Active Member

    I don't understand why XF coders made it so complicated that it has to put a load on the servers. I mean do they expect everyone to use template edits? Because not all mods can make use of those.

    Is there maybe a way where I can have my template code be within a variable?

    Like $soundcode

    and have php code locking it into the variable:
    $soundcode = 'embed';
     

Share This Page