SMF Support > SMF 2.0.x Support

Add a new Button

(1/5) > >>

songoty:
How do you add new buttons in the new Smf 2.0.3 Beta? Iv searched the indextemplate.php and i cant fin the area.

BuЯЯЯЯaK:
Subs.php


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

--- End code ---

metallica48423:
as the member above pointed out, the menu has been moved to Subs.php.

The block he posted is an example block for the home tab.

I may actually write a Doc up on this, just so we have it.  But or right now, let me explain this block.  The block parts are on the left, the explanation on the right for each line.


--- Code: ---'home' => array(                        ## This is Just the Array Key -- this needs to be unique and different from all the others within this section.
     'title' => $txt['home'],           ## The text to appear on the tab -- you can use a variable as in the example or hardcode the text such as 'title' => 'My Text',
     'href' => $scripturl,              ## The URL to go to, again this can be a variable or a hardcoded string such as 'href' => 'http://blablah.com',
     'show' => true,                    ## Show this tab.  True shows it.  False Hides it.  Simple, eh? ( you can use a permission here as well ) :P
     'sub_buttons' => array(            ## The Sub Button Array, On future themes that support it, your sub buttons/dropdowns will go here. 
      ),                                ##  This array is empty -- but we need to end it anyways.
),                                      ## Make sure to end the main array itself

--- End code ---

Skhilled:
Thanks for the tut, metallica48423. It is appreciated. :)

tpet96:
Does this look correct to you?  It does not show up on our forums menu bar when I save like this and upload.  The portion in question is the one entitled "CHAT" :


--- Code: ---{
$buttons = array(
'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
'chat' => array(
'title' => $txt['chat'],
'href' => 'http://ncogeo.com/forum/chat/amfichat.php',
'show' => true,
'sub_buttons' => array(
),
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version