For a more up to date version of this please see the doc siteSMF 2.0? See here insteadThe way you add links to the menu has changed in the new default theme. You will need to make several other steps in order to make the tabs work like they should. Here are the steps required to add a menu item. For this tutorial we are going to be adding a chat link.
1. In index.template.phpThere are two ways to do this. This first method is the recomemded one.
First method if ($context['current_action'] == 'search2')
$current_action = 'search'; if ($context['current_action'] == 'chat')
$current_action = 'chat';Second Method if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))As you can see it has a list of the actions in the menu. What we are going to do is add
, 'chat' after
'pm'. Each action in the array is separated by a comma and enclosed in single quotes (
'). It should look like this.
if (in_array($context['current_action'], array('search', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'chat')))The next step is adding the link itself. This is an example of the home menu.
2. In the same file // Show the [home] button.
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '">' , $txt[103] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '"> </td>' : '';- $current_action=='home' - is what sets the tab for the current actions. As you can see it is defined in 3 instances. You will need to change it for all three of them.
- ' , $txt[103] , ' - is the text string that 'Home'. As you see the variable is insde ' , , '. The reason for this is because it's inside an echo. If you are going to hard code the name in the menu you do not need to put ' , , ' around it.
This is how it should look with the made changes. // Show the [chat] button.
echo ($current_action=='chat' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'chat' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=chat">Chat</a>
</td>' , $current_action == 'chat' ? '<td class="maintab_active_' . $last . '"> </td>' : '';If you want to be neat about it and add support for other languages add this string to /Themes/default/languages/
index.english.php and to any other language file that you want to add it to. ie. /Themes/default/languages
/index.{language}.php and change Chat to the translated string.
$txt['chat'] = 'Chat';EDITI cleaned this tutorial up a bit.
If you find it a bit confusing please let me know so that I can recide it

-JayBachatero