R
ragtek
Guest
This is a VERY BASIC tuturial how to add own Tabs.
See the quote for more infos
1. Create your classfile in the xenforo directory. I named it ragtekTab
You need a class with an static method.
The method have to parameters (as said in the documentation^^)
2. Create a Code Event Listener which "listens" to navigation tab
Execute Callback: xenforo_ragtekTab :: addNavbarTab
That's it.
Now there should be a new tab
EDIT:
A quick note:
If you use a phrase for the tab title, you SHOULD cache the phrase.
This will save you an global DB Query!
See the quote for more infos

1. Create your classfile in the xenforo directory. I named it ragtekTab
PHP:
<?php
class XenForo_ragtekTab
{
/**
* add the "info" tab to the navbar
* @param array $extraTabs
* @param string $selectedTabId
*/
public static function addNavbarTab(array &$extraTabs, $selectedTabId)
{
$extraTabs['info'] = array(
'title' => new XenForo_Phrase('ragtek_infopage_navbartitle'),//phrase with the title for the link
'href' => XenForo_Link::buildPublicLink('info'),
'linksTemplate' => 'ragtek_infopage_navbar', //if you want to have a "sub menu" you can create a template for this
'position' => 'middle' //since beta 5, you can choose the position, where the link should be placed possible positions: [SIZE=3][FONT=Arial]middle end home[/FONT][/SIZE]
);
}
}
The method have to parameters (as said in the documentation^^)
2. Create a Code Event Listener which "listens" to navigation tab
Then you have to set the class & method nameCalled when preparing the tabs and links that are put in the main page navigation. You may use this event to add your own tabs.
Arguments:
- array &$extraTabs - you may push additional tabs onto this array. Each tab must be identified with a unique key (see $selectedTabId) and be an array with the following keys:
- title - title for the main tab
- href - link for the root of the tab
- selected - boolean that determines whether the tab is currently selected
- linksTemplate - the name of the template that contains the links that will be displayed in the second row. The outer HTML of this template should be a <ul class="secondaryContent blockLinksList">.
- string $selectedTabId - the name of the selected tab. Select your tab if this matches.
Execute Callback: xenforo_ragtekTab :: addNavbarTab
That's it.
Now there should be a new tab

EDIT:
A quick note:
If you use a phrase for the tab title, you SHOULD cache the phrase.
This will save you an global DB Query!