News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

[SOLVED] Edit Menu

Started by TheCase, June 11, 2008, 01:40:12 PM

Previous topic - Next topic

TheCase

Hi,

How do I change the menu at the top

Thanks

Owdy

Do you wanna add more items?
Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

N3RVE

Be Specific please,
Change the menu at the top to what? That will help us help you better.

-[n3rve]
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

TheCase

I would like to rename Home to Forum Home and add another link. Just cant find where they are stored

sawz

menu linkage is normally near the bottom of index.template.php of your theme.

to be more specific, knowing what theme you use would help.
keep smiling, they'll always wonder what your up too.....

TheCase

I'm using theme Gold Charm

Thanks

N3RVE

#6
For renaming the Menu Button
There are stored in language files, the files are in this dir ->
./Themes/default/Languages/
In this file ->
./Themes/default/Languages/index.english.php

Open them in an editor
Notepad ++ or Notepad2 recommended, using wordpad is not too bad.

Press Ctrl + F -> Search for "Home"
Put in "Forum Home" in place of "Home".

For Adding Custom Buttons:

Basically, this section:

if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))
$current_action = $context['current_action'];

controls how the highlighter is handled, so when you're a certain section that link is highlighted, like when you're in the Member List the Members link is highlighted.

You need to add the action name there, I have an action named "nerve" so for me to add that in, I would adjust the code to have:

if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'nerve')))
$current_action = $context['current_action'];

The second part involves actually adding the link itself.

Search for the likes of:

// Show the [help] button.
echo ($current_action == 'help' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'help' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
</td>' , $current_action == 'help' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Thats the link for the help button, but they're all the same so you can place it after any one of them. Now, for me to add my "nerve" link, I would place a button like this:

// For your Custom Button
echo ($current_action == 'nerve' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'nerve' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=nerve">' , $txt['nerve'] , '</a>
</td>' , $current_action == 'nerve' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

You'll notice there, that I've changed all instances of "help" to "nerve"

The final phase is adding in the language string in the languages folder there is a file called Modifications.language.php (where .language is your language eg. english) near the end, there is a closing:


?>


before that add something like:


$txt['nerve'] = 'nerve';


and then upload the files, and the changes should take effect.

I do recommend however that you create a copy of the default theme rather than making changes to it directly. You can do that in the Themes and Layout section, ignoring everything and going straight to clicking Install.

-[n3rve]
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

sawz

nice cut n paste job [n3rve], what post did you get that from, post the link please.
keep smiling, they'll always wonder what your up too.....

N3RVE

#8
Quote from: sawz on June 12, 2008, 07:10:13 AM
nice cut n paste job [n3rve], what post did you get that from, post the link please.

Cutting & Pasting is not a problem provided you are giving the correct solutions,
Giving links is also not a bad idea, however - the topic this was copied from does not have a topic relating to this problem, pasting the solution here will make things easier for those searching.
I keep a list of links with problems I know will come in from time to time so giving support will be easier. I replied because your last post is quite insignificant. Knowing the theme he uses is not actually a solution when they are all based off the default.

If you really want to find the actual topic, this forum has a great search function available for you to use ;)

@TheCase,
You can also see documentation
How do you add custom tabs to the Core (default) theme menu?

-[n3rve]
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

Dragooon

#9
Uhm, If he is using SMF 2.x, that would not apply.

The custom buttons are handled from the array $buttons found inside Subs.php

sawz

Quote from: [n3rve] on June 12, 2008, 07:17:57 AM


I keep a list of links with problems I know will come in from time to time so giving support will be easier. I replied because your last post is quite insignificant. Knowing the theme he uses is not actually a solution when they are all based off the default.
-[n3rve]
i keep a list of links as well, mine are a bit older, so i was curious where that came from.

as for insignificance, not all menus are based off the default theme.
so i guess that shows what you really know.
keep smiling, they'll always wonder what your up too.....

N3RVE

Quote from: Dragooon on June 12, 2008, 07:29:01 AM
Uhm, If he is using SMF 2.x, that would not apply.

The custom buttons are handled from the array $buttons found inside Subs.php

Thanks ;)

-[n3rve]
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

TheCase

#12
I dont have a langauge folder

TheCase

Its working now thanks

Advertisement: