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.