Simple Machines Community Forum

SMF Support => SMF 1.1.x Support => Topic started by: Loverboy on September 08, 2006, 05:51:40 AM

Title: How to add a link in the menu bar
Post by: Loverboy on September 08, 2006, 05:51:40 AM
(http://img70.imageshack.us/img70/4634/menugb4.jpg)

Could someone tell me how to add a link in the menu bar as you see above? I would like to add a link named: "radio" between "home" and "help" .. How can I do that?
Title: Re: How to add a link in the menu bar
Post by: B Patterson on September 08, 2006, 09:21:45 AM
In the template, open up "index.template.php" and scroll down until you see:
// Show the start of the tab section.
echo '
<table cellpadding="0" cellspacing="0" border="0" style="margin-left: 10px;">
<tr>
<td class="maintab_' , $first , '">&nbsp;</td>';

// Show the [home] button.


Now, each "button" will have a comment above it that tells you what it is:
// Show the [home] button.
// Show the [help] button.


Just before the help button code, you'd put the following:
// Show the [radio] button.
echo ($current_action=='radio' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '', '
<td valign="top" class="maintab_', $current_action == 'radio' ? 'active_back' : 'back', '">
<a href="', $scripturl,'?action=radio">Radio</a>
</td>', $current_action=='radio' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


So with the code surrounding it it would look something like:
// Show the [home] button.
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</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 . '">&nbsp;</td>' : '';

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

// Show the [help] button.
Title: Re: How to add a link in the menu bar
Post by: Loverboy on September 08, 2006, 09:52:33 AM
It worked ;) thankss