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

Code documentation?

Lawrence

Well-known member
#4
There isn't anything official at this time. When XenForo first came out, I was lost when it came to MVC. Mike advised me to go through the code, and that is what I did. I had a ton of questions and both Mike and Kier where very helpful in answering, or guiding me. Today there is a lot of tutorials available that you may want to read first, both official and unofficial. Finding a specific class is fairly easy, only because of how XF is structured. Each class is well documented within the file.

For example:

Loading of data is handled by a model. If you want to look at what is available for users then it's: library/XenForo/Model/User.php
Controllers handle the action. There are public, admin, response, and helper controllers. Members adjusting their account info (this is public), will be done here: library/XenForo/ControllerPublic/Account.php. Thread controller: library/XenForo/ControllerPublic/Thread.php

If you take a look at the controller file for Thread (just as an example), you should be able to tell exactly where each model, or view, is located as they follow the XenForo/Xxxxxxx/Xxxxxx structure.

This basic tutorial should help: http://xenforo.com/community/threads/creating-an-addon.5416/ I wrote it when I was still learning MVC, and made some changes as I learned more.

I hope this helps in the meantime.
 

euantor

Well-known member
#5
Even a simple PHPDocumenter API type page would be extremely welcome to me. I have a fairly adequate knowledge of PHP, but have never used Zend or any of XF's internal classes.
 

Chris D

XenForo developer
Staff member
#6
I have been able to learn PHP from scratch just by looking at the existing XenForo code.

No documentation required.

The best documentation is right there.
 

euantor

Well-known member
#7
True, but we don't all have hours of free time. Provided the code is commented correctly, running PHPDocumentor would only take a couple of minutes and would be extremely helpful. Many other projects use it to provide a basic overview of the classes (such as PyrCMS, Laravel, possibly even Zend Framework). Heck, I might just try running it my self so I can have a class reference to refer to and post a link up for people to use.
 

euantor

Well-known member
#9
Fair enough, just had a look at it for a quick five minutes and it seems most of the core has PHPDocuemntor tags where required. I'll generate the docs my self for personal use.