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

Creating my first ever addon

Discussion in 'XenForo Development Discussions' started by xpl0iter, Aug 2, 2012.

  1. xpl0iter

    xpl0iter Active Member

    I am trying to create my first ever addon. I need some help.
    Here I am going to explain all the stuffs I have done till so far.

    Folder Structure:

    Contents of Listener.php
    class WGBB_dailyCount_Listener
    public static function template_hook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
    if($hookname == 'ad_above_top_breadcrumb')
    $contents .= '<li><a href="http://www.webgurubb.com">Our Tab</a></li>';
    This is my Addon Configuration:

    This is my Code Event Listener Configuration:

    But this simply is not working, is there anything that I am doing wrong?
    Anyhelp will be very much appreciated!

    Chris D likes this.
  2. Chris D

    Chris D XenForo Developer Staff Member

    This line:

    if($hookname == 'ad_above_top_breadcrumb')

    Should be:

    if($hookName == 'ad_above_top_breadcrumb')

    You have to be pedantic about case sensitivity!
  3. xpl0iter

    xpl0iter Active Member

    Wt* seriously, this just wasted almost 10 hours of mine!
    Thanks mate, thanks you sooo much for pointing it out! :D
  4. Chris D

    Chris D XenForo Developer Staff Member

    We've all been there (y)

    At first glance I couldn't see anything wrong with your code at all, so I just knew it would be something minute like that - and it was.

    Good luck with the add-on.
  5. ragtek

    ragtek Guest

    Are you using an IDE?

    I would really suggest to use one (netbeans, phpstorm,zend studio,whatever.......)

    They'll show/highlight you all the (stupid) code mistakes, which are happening to all of us^^ (it won't even happen because of Autocompletion^^)

    e.g here's one undefined and one unused variable (gray variable name and red underwaved)
    Bob and Chris D like this.
  6. Chris D

    Chris D XenForo Developer Staff Member

    Yeah great suggestion.

    Personally, I've been using Eclipse Juno with the PDT tools add-on.

  7. MOZ

    MOZ Well-Known Member

    As Chris said we've all been there. I wasted 2 days with an issue which was with a the way my editor was encoding the file on my PC, code was fine and so was everything. Happens to all of us (y)
  8. Digital Doctor

    Digital Doctor Well-Known Member

    Chris are you good with AJAX code ?
    Ever done anything with Wordpress ?
    (unrelated questions BTW).
  9. Chris D

    Chris D XenForo Developer Staff Member

    I need to be good with AJAX stuff for something I'm working on at the moment :p

    And I've done tiny little customisations pertaining to AJAX for example the Quick Reply preview add-on and a little bit in my Notifications add-on.

    Learning way more about Javascript than I ever thought I would!

    And no, never done anything with WordPress.
    yavuz likes this.
  10. xpl0iter

    xpl0iter Active Member

    And I have created the addon! Will be adding it to the resources soon!
    borbole and Chris D like this.
  11. xpl0iter

    xpl0iter Active Member

    ShadyX likes this.
  12. borbole

    borbole Well-Known Member

    Congratulations on your first mod :)
    ragtek and xpl0iter like this.
  13. xpl0iter

    xpl0iter Active Member

    Thanks! :D
  14. Chris D

    Chris D XenForo Developer Staff Member

    Good work.
    xpl0iter likes this.

Share This Page