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.

Views: 21

4 thoughts on “How to Make Addons for MTF using the new engine”

  1. nexia dit :

    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. Drew dit :

    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.

  3. nexia dit :

    take your time, you’re in no rush Drew… 🙂

  4. Drew dit :

    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 🙂

Laisser un commentaire

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

En savoir plus sur Un Papa Pro

Abonnez-vous pour poursuivre la lecture et avoir accès à l’ensemble des archives.

Continue reading