TheBigK
Well-known member
After spending several days reading tutorials; I've decided to take my own baby steps in coding addons, so that I understand how the entire system works. However, it looks like I'm stuck at the very first step itself!
I've decided to code an addon that will -
Okay!
I'm thinking I need to do this:-
I went to AdminCP -> Development -> Navigation -> Route Prefixes -> Create New Route Prefix
Route Prefix: adder
Route Type: Public
Route Class: HUMM -> Gotta Write This Myself
Use Class To Build Link: Always
Addon : Adder
Now created -> Adder/Route/Prefix/Index.php with following code:-
Looking for the angels here to give me a push in the right direction.
I've decided to code an addon that will -
- Have its own location: localhost/xf/adder/
- This page will show two small input boxes to accept two numbers viz: [ No#1 ] + [ No #2 ] = (Calculate)
- User will enter two numbers and press (Calculate) button.
- The addon will calculate the result and store the result in the thread ID , which is specified in the admin option.
- So the add-on will create a thread which stores the results; each new calculated result as a new post in the thread.
- Created a new Addon in AdminCP, as 'Adder'
- Created a new folder named 'Adder' in the /xf/library/
- Installation/Uninstallation Class::Method - Not provided (I'm going to need it to create the tables in DB).
Okay!
I'm thinking I need to do this:-
- Create a Route Prefix called 'adder' - because I need to build path http://localhost/xf/adder/
- I need to create a template that will create input form & buttons on the path. [I am guessing that this is the 'VIEW' part of the MVC thingy]
- Write a MODEL that adds the numbers entered by the user and store the result in Database. I will need to create a DataWriter for this.
I went to AdminCP -> Development -> Navigation -> Route Prefixes -> Create New Route Prefix
Route Prefix: adder
Route Type: Public
Route Class: HUMM -> Gotta Write This Myself
Use Class To Build Link: Always
Addon : Adder
Now created -> Adder/Route/Prefix/Index.php with following code:-
Code:
class Adder_Route_Prefix_Index implements XenForo_Route_Interface
{
//SOMEONE TELL ME WHAT SHOULD GO HERE AND WHY?
}
Looking for the angels here to give me a push in the right direction.