How to Make Addons for MTF using the new engine

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.

4 réponses sur “How to Make Addons for MTF using the new engine”

  1. 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.

  2. 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.

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.