I’m almost complete with the base engine so I thought I would right a quick tutorial of how to make addons for it.
First File Structure
Files need to be named
class_mtf_(addon name).php
The (addon name) must be replaced by the id of the addon in the forum manager.
Second the File
Ok here is an example addon:
[PHP]< ?php
require_once(‘class_mtf.php’);
class mtf_articles extends mtf_MASTER
{
function mtf_articles(&$vbulletin)
{
parent::mtf_MASTER($vbulletin);
}
function threadBit()
{
$temp = array();
$temp = ‘blah’;
return array($temp, ‘new_threadbit’);
}
function FirstPostBit()
{
//Code
}
function PostBit()
{
//Code
}
}
?>[/PHP]
First you will notice this:
[PHP]
require_once(‘class_mtf.php’);
class mtf_articles extends mtf_MASTER
{
[/PHP]
This includes the base engine and inits the class. (Replace mtf_articles with mtf_***)
Next you see:
[PHP] function mtf_articles(&$vbulletin)
{
parent::mtf_MASTER($vbulletin);
}[/PHP]
This just sets everything up you can just ignor it.
Third you’ll notice
[PHP] function threadBit()
{
$temp = array();
$temp = ‘blah’;
return array($temp, ‘new_threadbit’);
}[/PHP]
This is function that controls this forum types display on the threadbit page. In this function all you really need to pay attention to is what it returns, which is an array with the first key being the an array of variables to pass along to vb and the template name to swap with the threadbit template.
You’ll notice two other functions in the code above they act the sane as the threadBit function except they swap the template which they are named for.
Views: 26
looks perfect to me… it is exactly what i had in mind when i asked you to make it pure OOP.
i know how work the classes, so now we just need the core to be completed and we can start working on how to deal with everything data/content.
The core right now is basicly done but I still have to add some plugins and it will be done.
The only other thing I need to (besides that) is finish the thread/forum field manager which can save a field and add the fields to the correct table but I haven’t done the front end for the new thread page and the forum manager.
take your time, you’re in no rush Drew… 🙂
I like to develop quick, not really pay attention to bugs, and move on to the beta stage which is when I take my time and work out every little bug 🙂