โค้ด index.template.php ตามนี้ครับ (ผมได้แนบไฟล์มาให้ด้วยนะครับ)
// Show the start of the tab section.
echo '
<ul>';
// Show the [main] button.
echo ($current_action=='MainSite' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '"> </td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'MainSite' ? 'active_back' : 'back' , '">
<a href="../">', $txt['MainSite'] ,'[/url]
</td>' , $current_action == 'MainSite' ? '<td class="maintab_active_' . $last . '"> </td>' : '';
// Show the [home] button.
echo '<li><a href="', $scripturl, '">' , $txt[103] , '[/url]</li>';
// Show the [help] button.
echo '<li><a href="', $scripturl, '?action=help">' , $txt[119] , '[/url]</li>';
// How about the [search] button?
if ($context['allow_search'])
echo '<li><a href="', $scripturl, '?action=search">' , $txt[182] , '[/url]</li>';
// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo '<li><a href="', $scripturl, '?action=admin">' , $txt[2] , '[/url]</li>';
// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '<li><a href="', $scripturl, '?action=profile">' , $txt[79] , '[/url]</li>';
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo '<li><a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '[/url]</li>';
// The [calendar]!
if ($context['allow_calendar'])
echo '<li><a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '[/url]</li>';
// the [member] list button
if ($context['allow_memberlist'])
echo '<li><a href="', $scripturl, '?action=mlist">' , $txt[331] , '[/url]</li>';
// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo '<li><a href="', $scripturl, '?action=login">' , $txt[34] , '[/url]</li>';
// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo '<li><a href="', $scripturl, '?action=register">' , $txt[97] , '[/url]</li>';
// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo '<li><a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '[/url]</li>';
echo '</ul>';
}
// Generate a strip of buttons.
function template_button_strip($button_strip, $direction = 'top', $force_reset = false, $custom_td = '')
{
global $settings, $buttons, $context, $txt, $scripturl;
// Create the buttons...
foreach ($button_strip as $key => $value)
{
if (isset($value['test']) && empty($context[$value['test']]))
{
unset($button_strip[$key]);
continue;
}
elseif (!isset($buttons[$key]) || $force_reset)
$buttons[$key] = '<a href="' . $value['url'] . '" ' .( isset($value['custom']) ? $value['custom'] : '') . '>' . $txt[$value['text']] . '[/url]';
$button_strip[$key] = $buttons[$key];
}
if (empty($button_strip))
return '<td> </td>';
echo '
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_' , $context['right_to_left'] ? 'last' : 'first' , '"> </td>
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_back">', implode(' | ', $button_strip) , '</td>
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_' , $context['right_to_left'] ? 'first' : 'last' , '"> </td>';
}
?>