Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: jamiesage123 on May 28, 2011, 11:36:09 AM

Title: How do you add / edit menu buttons
Post by: jamiesage123 on May 28, 2011, 11:36:09 AM
Hi,

I would like to know how to add / edit menu buttons on the "Fresh" theme. I've looked at the "How do you add custom tabs to the Core (default) theme menu?" and some other tutorials; unfortunately they didn't help.

I can't find this in the "Fresh" theme:

(http://screensnapr.com/e/IaM3zm.png)
Title: Re: How do you add / edit menu buttons
Post by: All Colours Sam on May 28, 2011, 12:00:32 PM
Hi jamiesage123 what version of SMF are you using?   depending on the version is the way to add new buttons to your menu.

by your message I suspect your using 1.1.x, if so, feel free to attach your theme's index,template.php file and I can assist you.
Title: Re: How do you add / edit menu buttons
Post by: jamiesage123 on May 28, 2011, 12:06:26 PM
I'm using SMF 2.0 RC5 if that is what you mean.

I've attached the index.template.php
Title: Re: How do you add / edit menu buttons
Post by: All Colours Sam on May 28, 2011, 12:11:29 PM
oh!   then you must follow this tutorial:  Adding tabs to SMF 2.0 (http://www.simplemachines.org/community/index.php?topic=261880.0)


on 2.0 you add buttons on your Sources/Subs.php   and it will automatically appear on every theme you use.
Title: Re: How do you add / edit menu buttons
Post by: jamiesage123 on May 28, 2011, 12:21:04 PM
Gah, that doesn't work for me either.

I added a "Test" button; but it still doesn't show:
(The Home button is in the correct position, but it didn't align correctly on here)


                                'home' => array(
'title' => $txt['home'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',
'show' => true,
'sub_buttons' => array(
),
),
'test' => array(
'title' => $txt['test'],
'href' => $scripturl,
'show' => true,
'sub_buttons' => array(
),
),
'search' => array(
'title' => $txt['search'],
'href' => $scripturl . '?action=search',
'show' => $context['allow_search'],
'sub_buttons' => array(
),
),
Title: Re: How do you add / edit menu buttons
Post by: All Colours Sam on May 28, 2011, 12:25:46 PM
you must add this $txt['test']   to your   Themes/default/lanfuages/index.language.php  file

at the end before the ?>


$txt['test'] = 'Test button'; 

and clean your cache in admin / maintenance / forum maintenance / cache
Title: Re: How do you add / edit menu buttons
Post by: jamiesage123 on May 28, 2011, 12:39:15 PM
I cant find the index.language.php file.

(http://screensnapr.com/e/qB9ijL.png)
Title: Re: How do you add / edit menu buttons
Post by: All Colours Sam on May 28, 2011, 12:41:16 PM
its on your default   folder and not the theme you are using:

/Themes/default/languages/index.language.php   where  language is the language you are currently using,  example  index.english.php
Title: Re: How do you add / edit menu buttons
Post by: jamiesage123 on May 28, 2011, 12:53:26 PM
I've added $txt['test'] = 'Test button';  to index.english.php, and ran "Empty the file cache". Still nothing. :E
Title: Re: How do you add / edit menu buttons
Post by: All Colours Sam on May 28, 2011, 01:04:56 PM
can I have a link to your forum?


are you sure you are using english as your language and not english-utf8 or other language?


can you attach your /Themes/default/languages/index.english.php here.
Title: Re: How do you add / edit menu buttons
Post by: jamiesage123 on May 28, 2011, 01:14:09 PM
http://jamies-servers.gaming.multiplay.co.uk/forums/ (http://jamies-servers.gaming.multiplay.co.uk/forums/)

Yep, it is English. :P

And index.english.php is attached.
Title: Re: How do you add / edit menu buttons
Post by: All Colours Sam on May 28, 2011, 01:36:40 PM
I searched your file and couldn't find any  $txt['test']   on it, make sure you add this to your index.english.php file:


$txt['test']  = 'Test':   


at the bottom before  the ?>
Title: Re: How do you add / edit menu buttons
Post by: jamiesage123 on May 28, 2011, 02:06:37 PM
I had two of the same folders, in different locations. I was using the wrong one O:)

It worked, thank you so much!