News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.

Main Menu

Code Test Bug

Started by SleePy, Apr 24, 2008, 03:04 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

SleePy

In SMF2 the tabs have moved from the index.template.php, just so themes can work fully, these are now located in Sources/Subs.php

To add a new tab search for:

// All the buttons we can possible want and then some, try pulling the final list of buttons from cache first.

now a few lines down you will see:

'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),


This is the start of the tabs, to add a new tab you would simply sort this, for this tutorial I will break each line up,

'home' => array(

This is simply call tag just for identifcation, it is important that you have this and the  ' ' or the tab will not work, for this tutorial we will assume that I have a custom page made up called Rules the above line would then be

'Rules' => array(

Next we shall look at the next line:

          'title' => $txt['home'],

Yes this is a text string you could hardcode this but its more advisable to use a txt string specially if we are using another language besides for english.

            'title' => $txt['rules'],
For more information on txt strings please refer to Txt Strings (SMF Doc Site

now lets look at:

'href' => $scripturl,

This should be obvious to most people however this line is the link to the file this could be a direct link such as

'href' => 'http://www.smfthemes.org',

or a scripturl

'href' => $scripturl. '?action=rules',

Next we have the show tab or not for everyone to see you would leave as is

'show' => true,

but you could use

'show' => $context['allow_admin'],
if wanting only admins

now for final line

'sub_buttons' => array(

unless you wish for extra options in that new tab then you wouldnt need to change this.

So for final code for my nice new rules tab:

'Rules' => array(
'title' => $txt['rules'],
'href' => $scripturl . '?action=rules',
'show' => true,
'sub_buttons' => array(
),
),

No siggy! :D

Quick Reply

Warning: this topic has not been posted in for at least 30 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it has been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
Shortcuts: ALT+S post or ALT+P preview