1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Building Your First Addon Second Trial

Discussion in 'Development Tutorials [Archive]' started by Ajaxboy, Feb 11, 2011.

  1. Ajaxboy

    Ajaxboy Active Member

    How to create an addon tutorial part#1
    The Starter's Guide

    Will add more parts as time allows :)

    This tutorial assumes you are not too familiar with xenforo platform, but it does assume that you are an experienced developer and that you are familiar with the MVC Model.

    I know there is already a "how to" create an addon tutorial some where. When I was new to xenforo it wasn't at all clear to me. It assumed I was already familiar with the xenforo platform.

    Thankfully with the help of my friend Jeremy (Jeremy_P here on the forums), I was able to dig into the code and went to him for immediate questions.

    If you are one of these developers who isn't too in depth into the code, or you are a new developer to xenforo this is for you to get your toes wet. I also noticed these migrating from vbulletin already posses some background on how the platform works, nonetheless I hope many of you find this tutorial useful.

    Be sure to like it.

    So this new tutorial is directed to developers who are not as familiar how the xenforo platform/framework works.


    1. Abstracts/Overall Overview

    The abstracts is the none technical information directed to help you understand better how to start building your own addon.​

    In the overall, we are going to focus on a "Hello_World" addon, so that you can relate more.​

    Some of the core tips:​

    • Xenforo users extensive assistance from the Administration UI to create addons. This can be very tedious, annoying and painful at first if you are not used to this. But once you find your way around it becomes all clear.
    • The library directory is your home directory as a xenforo developer. Every addon or custom modification you do, will go in here.
    • Each addon has it's own directory in the library directory. So if you create an addon you will need to create a directory here.
    • The naming of the classes represent the path directory of each file (with exception of the library directy). Eg. If you want to call a class it is always consistent, "YourAddonDictory_FileName" so in this fake class, your file would be in the library directory as "library/Hello_World/FileName.php" and assumes "FileName.php" has a class with the name "YourAddonDictory_FileName".
    • You may use assistance from the rest of the xenforo's classes and existing code by using the same logic. There is a xenforo directory inside the the library directory, and the same applies here. So if you need assistance to create a thread or message, or any of these every day tasks xenforo already does, you make the use of classes through the xenforo framework. In this example "xenforo_subdirectory_file" would look for a file in "library/xenforo/subdirectory/file.php". Within the xenforo directory everything is categorized properly so you can easily locate anything that you may need. Eg. If you want to do something related with users and data, you can easily assume to look into a file "Xenforo/Model/User.php", something dealing with threads and data, would go to "Xenforo/Model/Thread.php" and so on.
      • Use XenForo_Model::create($class); to create a new class. Eg. XenForo_Model::create("Hello_World_Model_File"); (would locate a file in "library/Hello_World/Model/File.php")
     
    0xym0r0n, nacs, Fuhrmann and 3 others like this.
  2. Ajaxboy

    Ajaxboy Active Member

    Part # 2

    2. Admin - Addon Relationship

    The administration has at least 30% to 40% participation on the creation of your addon. You use the admin for just about everything, create templates, phrases, addon options, and so on.

    The good news is, at the moment you create something, at creation time is associated with the addon, usually you will see the addons listed at creation time when you create any of the things mentioned above. Then you can just use it and forget about it. At the time you release your addon, you just export an XML file from the administration which automatically picks all that information, and you don't need to worry about packing and things like that, other than exporting your xml file and place it in your addon directory and otherwise pack it ready for release.


    • Creating Phrases
      • Phrases are like language entries used in your addon.
      • Click "Appearance" menu, down on the left menu you should see the "Phrases" option.


    • Exporting an addon
      • To export an addon go to the administration on the right side menu at the bottom click on "Management Addons".
      • Hover over your addon to the right on "Controls" option, a dropdown should pop, click export.
     
    oDinZu, 0xym0r0n, Fuhrmann and 3 others like this.
  3. Ajaxboy

    Ajaxboy Active Member

    Part #3 talks about event listeners and such.. stay tune!..
     
  4. steven s

    steven s Well-Known Member

  5. bubbl3

    bubbl3 Active Member

    This was very interesting, sadly there's no part 3....
     
    Michael Dance likes this.
  6. DaveL

    DaveL Well-Known Member

    Hi, was just wondering if you had part three at all?
     
  7. MGSteve

    MGSteve Well-Known Member

    arg, why do people start these and not finish them :(
     
    otto, Fuhrmann, Bain and 1 other person like this.

Share This Page