News:

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

Main Menu

Help replacing menu

Started by mike16889, June 02, 2006, 09:50:07 AM

Previous topic - Next topic

mike16889

i am trying to replace the menu in a theme with a java script menu i don't know much about php and have got a bit of code to replace the menu with  here it is // Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;

echo '<div id="menumain"><ul id="menulist">';

if ($context['allow_admin']){
<script language="JavaScript" src="Admin.js"></script>
}

else if ($context['allow_edit_profile']){
<script language="JavaScript" src="User.js"></script>
}

else if ($context['user']['is_guest']){
<script language="JavaScript" src="Guest.js"></script>
echo '</ul></div>';
}
}

?>


i want to put that in the index.template.php instead of
// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context, $settings, $options, $scripturl, $txt;


echo '<div id="menumain"><ul id="menulist">';
// Show the [home] and [help] buttons.
       echo '<li><a href="', $scripturl, '">'.$txt[103].'</a></li>';
       echo '<li><a href="', $scripturl, '?action=forum">', 'Forum', '</a></li>';
       echo '<li><a href="', $scripturl, '?action=help" target="_blank">', $txt[119], '</a></li>';

// How about the [search] button?
if ($context['allow_search'])
echo '<li><a href="', $scripturl, '?action=search">', $txt[182] , '</a></li>';

      // Is the user allowed to administrate at all? ([admin])
        if ($context['allow_admin']){
                echo '<li><a href="', $scripturl, '?action=admin">', $txt[2], '</a></li>';
                        }

// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo '<li><a href="', $scripturl, '?action=profile">', $txt[467], '</a></li>';

// The [calendar]!
if ($context['allow_calendar'])
echo '<li><a href="', $scripturl, '?action=calendar">', $txt['calendar24'], '</a></li>';

// If the user is a guest, show [login] and [register] buttons.
if ($context['user']['is_guest'])
{
echo '<li><a href="', $scripturl, '?action=login">', $txt[34], '</a></li>
<li><a href="', $scripturl, '?action=register">', $txt[97], '</a></li>';
}
// Otherwise, they might want to [logout]...
else
echo '<li><a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', $txt[108], '</a></li>';
echo '</ul></div>';
}

?>


i made the code by cutting and pasting from the template file with my little nolage of java that i Am learning in school.

i would much appreciate it if some one would help me out.

Advertisement: