Where is the best place to start when developing an add on?

RichardKYA

Well-known member
Hi everyone,

I have an idea for an add on and I would like to give developing it a go myself. I know very little about PHP, etc, but I understand the concept and I know I have a lot to learn, but I've been trying to learn PHP amongst other languages for a while now, but I can't seem to get beyond the very basics and because I have this idea for an add on, I think it will be good way for to me learn because it will serve as some motivation and at least what I will be learning will have some sort of direction instead of trying learn for the sake of learning.

Like I say, I can grasp the very basics and I have a vision for the bigger picture, but I still have zero idea how it all goes together.

It's like having a wheel, a gear stick, a couple of doors and a photo of a car.

I know what I want the end result to be, I have a few parts and can understand what these singular parts do and the concept behind them, but I have no idea how to build them, let alone get them all working together and there are still thousands parts missing which I also have no idea about.

I guess what I am asking for is kind of a "blueprint" of how to build an add on. It doesn't have to be fully detailed, just some sort of order in which to start building? As in, what script/s do you start with? What function are these scripts meant to perform?

I worked in construction for over a decade and I could build you a house from the ground up, so I understand that with any kind of building there always are a lot of variables, but there is also always a method to each part that have to follow a certain set of specifications.

So to give you an idea of what I am hoping my add on to have...

  • Create/edit item page - similar to create thread page
  • automatic thread creation per item
  • Item main page with tabs to the item thread and possibly another page - similar to resource pages
  • "All items" list view page
  • "User items" list view page
  • Profile page tab and user items
  • search items
  • general add on permissions
  • mod permissions
  • alerts/alert preferences
  • item likes
  • report item
There's a number of other things and more to it than this, but this is just to give you some idea of the scale that I have in mind.

It's a huge ask of myself and I know it's going to take quite some time, but like I say, I want to learn and I have been trying, but the tutorials I've been watching and reading just seem to either teach the basics or teach really complex stuff, which is good, but it's directionless, especially when you have no idea where/when to use anything that you do learn.

I would really appreciate some help on where to start and maybe some sort of direction/method to follow.

Thank you for any help or useful tips :)
 
As a fellow noob at creating add-ons I would suggest you're a bit ambitious :)


The easiest way to learn is to get a simple idea – Make_all_caps as an add-on. Then, find an add-on which does something similar and see how they have done it. I find the add-ons by AndyB to be very helpful. (I still need to fling him some more beer tokens) Take a look at his Convert Image add-on. It’s very straight forward to follow.


Start there, work on. A lot of other posts suggest a pretty good understanding of MVC and how that works etc but I think that complicates it at the start. Understanding how the hooks work and how to get stuff done is easier. Refine it after that.


I would say the most frustrating part of it all is working out what does what. I’ve not fully understood how it all hangs together and when I want to do X I need to hook Y. Some documentation would be nice but understand that they’re also pretty busy with that-which-pays-the-bills.


Also there are a shed-load of threads around with tutorials, some nice videos by the XF guys on how to do stuff. Loads to find and learn



C
 
Hi Crispin,

Thank you for your reply, some helpful tips there :)

Yeah, I know my add on is very ambitious, but I think I need something to get my teeth into because I'm just not learning much anymore by reading tuts/articles and watching videos, it's not sticking because it doesn't have any context, I need something that I can develop, so I can see what's going on, what's going wrong, what needs to be done to correct it, etc and find out what does what that way. Tutorials are great, but they're just don't lead anywhere, so it's hard to make any progress with learning. Similar to learning any foreign language, tuts will only get you so far until you actually need to be somewhere you can use the language and understand via interaction.

I'm a "throw me in the deep end" kind of learner. I think most people are to be fair, I mean, you could tell someone how to drive for as long as you like, but until they get behind the wheel, they're not gonna know anything about driving.

Experience is the best teacher.

Apart from my English teacher in school, she was hot.

That saed, moi engrish is terryball and I'm wos boarn and raced in Ingerland.

:)
 
Hey,

I am in the same boat as you. I can share my experiences so far (~10 days).

------------------------------------------

A)
First of all, we need a fundament. The fundament is php.

In my opinion you need to understand/know this at first: http://php.net/manual/en/langref.php
After that basic knowledge in SQL: http://www.w3schools.com/sql/default.asp
Get an IDE and a debugger after that, setup a XAMPP local server and put XF files in it and you are good to go.

B)
Now it comes down to XF architecture itself.
I went through all development tutorials after that. So I can get a feeling for it.

My recommendations for the start are this:
1) https://xenforo.com/community/threads/creating-an-addon.5416/
2) https://xenforo.com/community/resources/understanding-the-xenforo-class-proxy-system.2080/
3) https://xenforo.com/community/resources/how-to-read-and-write-into-the-database-with-a-page.328/

Those 3 guides helped me a lot to understand the procedure of creating an addon. Specially finish the addon of Lawrence, then you see by first hand how the process is going. They give you a brief understanding of how everything is connected with each other.
After you get a feeling for how it works, go back to the development tutorials and read again and again the tutorials. With each time you understand more. Not everything, but certainly you are beginning to see the big picture.

C)
After that, when you feel you had enough of the same stuff over and over again. Go and do this:
Go to the Xenforo Development Discussions forum and go to the last page of it (currently page 183).

You will see, that back in the days when XF was new, many people started like you and me from scratch. So they asked at that time all the questions we have now. Revisiting those old threads are so helpful. Skip those threads with no answers obviously, but open every thread with an answer. You may skip a lot of them due they are too complex to understand, but some are not complex and you see what is going on, when somebody corrects a method or tells a guy how to do something. (currently I am on page 153 and saved some of the threads in a txt document for re-reading).

D)
The name AndyB, who is a great guy, was mentioned. The next step will be to go along his path, when he started developing. He has a lot of great threads where you can see step by step a development. See: https://xenforo.com/community/search/8245626/?page=7
This I saved for re-reading:

E)
Next step would be to start small. Now after all this information, we should be able to create our own little addons. Start small. At least I will try to do that. So try to extend some existing classes or existing features like notices criteria or try to do template modifications. For that also download free addons and see how they did it.

F)
After that go bigger, now try to work with something which writes or reads from the database. Now SQL will be needed.

G)
After steps A-F we are finally on the level of creating small addons with 1-5 features. After that expert level stuff begins. And your project you talked about is expert level stuff. But as you have a basic knowledge for development now, you should be able to create your project part by part.

H)
AJAX/Javascript begins.

------------------------------------------

This is the approach I have at this moment. Of course, don't forget that XF 2.0 is on the way. That means all of the stuff we learned, will maybe irrelevant and we need to start over. But better to start now and get knowledge as much as you can, than waiting and doing nothing.

My biggest issue with my evolvement is, that all of the tutorials and discussions don't explain how XF did something and how we can learn from it.
Usually, the common answer is: "Go and look in .../.../...php files and see how XF did it." But they never explain how in first instance XF did it and how everything is connected with each other. Like how they use their IDE to quickly find things, to quickly debug things, to quickly see which parameters is passed to where etc. I don't know all these stuff yet. Anyway, don't give up, I won't.

So far this is my understanding how everything is connected:

When you read from the database, you go to the models.
When you want to write into the database, you use the datawriter (not controller or model).
When you want that the user sees something, you use the view by using html/css and helpers (xen-syntax).
And the controller connects everything. That is the core part to understand. Because he handles everything, everything is passed to him and he passes over. That is the big picture we need to understand. He is what we need to modify all the time.


I hope this helps a bit. Maybe experienced users can correct me or give us better directions.
 
Last edited:
Hi @sbj

It's good to know that someone else is in the same boat. What are you using to learn PHP? I've been watching a lot of lynda.com tutorials and reading various stuff online, but it seems to go from very basic stuff to extremely complex stuff with no guidance in between lol

I have a local development area set up already and I'm currently using Dreamweaver. I've tried other software, phpstorm, netbeans, coda, sublime text, etc, but I can't seem to find one that I like. Is there an IDE that you can recommend?

Thank you for your very informative response, I'm sure I'll find a lot of it to be useful (y)
 
According to this thread and this one the most recommended one is by far PhpStorm, then followed by PhpED.
I can't give my recommendation, as I am new to IDEs and PHP in general, but I followed others recommendations and went with PhpStorm, like all official XF devs.

What am I using to learn PHP? I think I finished that chapter already. Sure, I don't know everything and I need to re-read stuff to use the correct syntax, but I got the basics already. To be fair, I had c++ at my university, and know already the basics with functional programming and OOP. And that is what you definitely need to know. I linked above which chapter of the php.net documentation you need to know or understand vaguely, to be able to start developing. Of course, when you see the documentation, there are a lot of other stuff like cookies, sessions, extensions and security. But we are not professionals, and those stuff are for advanced people, not for beginners. For addon development you don't need them. And if you do, you go and just learn that part you need to know. But we are far away from that, as we are beginners level right now.

So, I strongly recommend php.net manual as it is really well structured and rich with examples. And under the examples you find the user contributed notes, which helps you more, if you didn't understand something.
I also liked these resources on Phpro.org: for OOP and for MVC.

If you are looking for videos, there are a lot of them on udemy. I'm not sure how good the idea is to pay for those videos, as you can find on the internet many things for free (legal or illegal). But yeah, udemy is very popular.
As a legal free source I can recommend TheNewBoston series.

Besides that, if you want to practice coding/writing, so far everything is heavily based on reading, I recommend codecademy. So you can type stuff and see the syntax and logics by doing your own code.
There is also Khan Academy, but I haven't tested them yet.

I hope these resources will be useful to you or anyone.
 
Funny enough, I used thenewboston series a couple of years ago to learn html, css and some js. I found Bucky's vids to be the most watchable because his teaching method seem to work for me. I have tried using thenewboston php series a few times, but it's not Bucky and it's some other guy called Alex and the way he teaches doesn't seem to work for me, it's too "dry", whereas Bucky had personality so it made it easier to remember things and he taught it in an "idiot-proof" way which extremely helpful for me, being an idiot and all. lol

I haven't come across udemy yet, not that I'm aware of anyway, so I will definitely take a look for those videos "legally".............. :whistle:

Maybe I'll check phpstorm out again as well, I think they've released a new version now.

Thank you for your help, I appreciate it (y)
 
Back
Top Bottom