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

How to make a basic addon?

Discussion in 'XenForo Development Discussions' started by George, Mar 1, 2011.

  1. George

    George Active Member

    Ok I have read over some of the tutorials for making an addon. I have not been able to find one for making a basic addon that uses hooks. I want to hook into the footer links. So far I created the addon and stared to make the options in the adminCP. Just to make options there are so many settings. I am now lost, and I come from a knowledge of vBulletin coding with moderate knowledge of PHP. I havent did to much with classes and listeners and all this fancy xenForo coding.
    [​IMG]
    What I want to do with this option is have a simple on and offheck box.
    Is Format Parameters correct?
    What do I put for Data Type?
    Default value would be I guess "no"?
    Array Sub-Options should be left blank?
    Validation Callback would be what exactly?

    After that what would be my next step to hook a specific template. I am lost when it comes to developing xenforo. :(

    Should I even use a template or just make a options box in the settings for the few links I will add?

    Any guidance would be very helpful and much appreciated.
     
    dieketzer likes this.
  2. Kier

    Kier XenForo Developer Staff Member

    Take a look at The Happy Place add-on for an example of how to use a template hook to extend an existing template with another :)
     
  3. Jaxel

    Jaxel Well-Known Member

    triple post much?
     
    Brett Peters likes this.
  4. George

    George Active Member

    Thanks Kier

    Thanks Kier

    Thanks Kier [​IMG]
     
    Brett Peters likes this.
  5. Kier

    Kier XenForo Developer Staff Member

    Posting over 3G fail. Someone at my ISP needs to be murdered to death.
     
    GofD, Darkimmortal and Walter like this.
  6. Mikey

    Mikey Well-Known Member

    As opposed to murdered to life? :)
     
  7. Kier

    Kier XenForo Developer Staff Member

    Most certainly.
     
    Mikey likes this.
  8. GofD

    GofD Well-Known Member

    They put the 3 in 3G! :p
     
  9. George

    George Active Member

    Kiers post will also answer that one too.
    [​IMG]
     
  10. Kier

    Kier XenForo Developer Staff Member

    Actually, they put the 7 in 3G, I deleted 4 before I gave up ;)
     
  11. George

    George Active Member

    All the more reason to have a auto merge feature built in. You removed 4 and gave up. Then I went and made 3 more for you. Then your other 2 had to be removed. My how this thread had so many removed post with no insults or arguing. LMAO
     
  12. GofD

    GofD Well-Known Member

    LMAO. "Forum Developer Fails at Posting: Story at 7, 8, 9, 10, 11..."
     
    Mikey likes this.
  13. George

    George Active Member

    Ok back on topic. I have the basic addon working. Now how do I get it to listen to the options(like on and off settings)?

    Edit:
    I figured out how to do it on the template level. How do you do it on the Listner level?
    I have options that I need to pull for which template I want to use to place the links.

    Edit 2:
    Ok never mind I am getting it now.
     
  14. Kier

    Kier XenForo Developer Staff Member

    To get an option:

    $option = XenForo_Application::get('options')->myOption;

    or

    $options = XenForo_Application::get('options');
    $option = $options->myOption;
     
    cclaerhout and George like this.

Share This Page