Simple Machines Community Forum

Archived Boards and Threads... => Archived Boards => SMF Feedback and Discussion => Aiheen aloitti: JTD - heinäkuu 05, 2004, 10:15:00 AP

Otsikko: Adding a drop down menu
Kirjoitti: JTD - heinäkuu 05, 2004, 10:15:00 AP
Hello I just installed your forums and they work great. :) I wanted to know if it was possible to add a drop down menu to the index.template.php Just to the right of the navigation buttons. IE  home,help,search and so on. This is what i want to use After I change the links. Thank you for your help.

Lainaa<p align="center"><form method="post" name="nameform">
<font color="#9933CC" size="2"
face="Times New Roman"><select name="tanyasmenu"
size="1"
style="BACKGROUND: #FFDAB9; BORDER-BOTTOM:
outset; BORDER-LEFT: outset; BORDER-RIGHT:
outset; BORDER-TOP: outset; COLOR:  #B03060;
FONT-FAMILY: Comic Sans MS; FONT-SIZE: 10px">
<option selected
value="http://www.marys-creature-comforts.ravenprom.org/fudge.html">Fudge</option>
<option
value="http://www.marys-creature-comforts.ravenprom.org/beds.html">Pet Bed's</option>
<option
value="http://www.ravenprom.org/guestbook/">Guest Book</option>
<option value="http://www.marys-creature-comforts.ravenprom.org/links.html">Link's</option>
</select> <input type="button" value="Go"
onclick="location =
document.nameform.tanyasmenu.options
[document.nameform.tanyasmenu.selectedIndex].value;"
style="BACKGROUND: #FFDAB9; COLOR: #B03060; FONT-FAMILY:
Comic Sans MS; FONT-SIZE: 10px">
</form></center>
       
Otsikko: Re: Adding a drop down menu
Kirjoitti: [Unknown] - heinäkuu 05, 2004, 11:06:56 AP
Just add it in index.template.php, where you want it, and replace any ' in it with \'.

-[Unknown]
Otsikko: Re: Adding a drop down menu
Kirjoitti: JTD - heinäkuu 05, 2004, 11:40:11 AP
Ok this is what I now get. After uploading that to the template. And actually there where only 2 of these ' in the code one here--> Pet Bed's and one here-->Link's So I just removed them all together. But I still get that error below. Any suggestions  ???

Parse error: parse error in /home/ravenpro/public_html/forums/Themes/default/index.template.php on line 428
Otsikko: Re: Adding a drop down menu
Kirjoitti: [Unknown] - heinäkuu 05, 2004, 11:41:02 AP
Can you quote the section you put it in?  Meaning a few lines before and a few lines after?

-[Unknown]
Otsikko: Re: Adding a drop down menu
Kirjoitti: JTD - heinäkuu 05, 2004, 11:49:38 AP
yes I can here it is. the top one will be line 428 as in the error. And the other will be from the template itself. This is only a partial part of the code hope it makes sense. ::)
PS here is the forum page itself. http://www.ravenprom.org/forums/index.php

LainaaParse error line 428--> <p align="right"><form method="post" name="nameform">

LainaaThe actual code now.

// Show the menu up top.  Something like [home] [help] [profile] [logout]...
function template_menu()
{
   global $context, $settings, $options, $scripturl, $txt;

   // Show the [home] and [help] buttons.
   echo '
            <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'], '
            <a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];

   // How about the [search] button?
   if ($context['allow_search'])
      echo '
            <a href="', $scripturl, '?action=search">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/search.gif" alt="' . $txt[182] . '" style="margin: 2px 0;" border="0" />' : $txt[182]), '</a>', $context['menu_separator'];

   // Is the user allowed to administrate at all? ([admin])
   if ($context['allow_admin'])
      echo '
            <a href="', $scripturl, '?action=admin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/admin.gif" alt="' . $txt[2] . '" style="margin: 2px 0;" border="0" />' : $txt[2]), '</a>', $context['menu_separator'];

   // Edit Profile... [profile]
   if ($context['allow_edit_profile'])
      echo '
            <a href="', $scripturl, '?action=profile">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/profile.gif" alt="' . $txt[79] . '" style="margin: 2px 0;" border="0" />' : $txt[467]), '</a>', $context['menu_separator'];

   // The [calendar]!
   if ($context['allow_calendar'])
      echo '
            <a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 2px 0;" border="0" />' : $txt['calendar24']), '</a>', $context['menu_separator'];

   // If the user is a guest, show [login] and [register] buttons.
   if ($context['user']['is_guest'])
   {
      echo '
            <a href="', $scripturl, '?action=login">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/login.gif" alt="' . $txt[34] . '" style="margin: 2px 0;" border="0" />' : $txt[34]), '</a>', $context['menu_separator'], '
            <a href="', $scripturl, '?action=register">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/register.gif" alt="' . $txt[97] . '" style="margin: 2px 0;" border="0" />' : $txt[97]), '</a>';
   }
   // Otherwise, they might want to [logout]...
   else
      echo '
            <a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/logout.gif" alt="' . $txt[108] . '" style="margin: 2px 0;" border="0" />' : $txt[108]), '</a>';
}
<p align="right"><form method="post" name="nameform">
<font color="#9933CC" size="2"
face="Times New Roman"><select name="tanyasmenu"
size="1"
style="BACKGROUND: #FFDAB9; BORDER-BOTTOM:
outset; BORDER-LEFT: outset; BORDER-RIGHT:
outset; BORDER-TOP: outset; COLOR:  #B03060;
FONT-FAMILY: Comic Sans MS; FONT-SIZE: 10px">
<option selected
value="http://www.marys-creature-comforts.ravenprom.org/fudge.html">Fudge</option>
<option
value="http://www.marys-creature-comforts.ravenprom.org/beds.html">Pet Beds</option>
<option
value="http://www.ravenprom.org/guestbook/">Guest Book</option>
<option value="http://www.marys-creature-comforts.ravenprom.org/links.html">Links</option>
</select> <input type="button" value="Go"
onclick="location =
document.nameform.tanyasmenu.options
[document.nameform.tanyasmenu.selectedIndex].value;"
style="BACKGROUND: #FFDAB9; COLOR: #B03060; FONT-FAMILY:
Comic Sans MS; FONT-SIZE: 10px">
</form></right>
{

?>
Otsikko: Re: Adding a drop down menu
Kirjoitti: [Unknown] - heinäkuu 05, 2004, 04:30:04 IP
Put the section above the }, don't add a {, and put this before it:

echo '

And this after it:

';

-[Unknown]
Otsikko: Re: Adding a drop down menu
Kirjoitti: JTD - heinäkuu 05, 2004, 04:48:50 IP
Thank you very much works great. :D
Otsikko: Re: Adding a drop down menu
Kirjoitti: mzulkoski - syyskuu 10, 2006, 07:12:24 IP
JTD and [unknown],

Thanks for the code.

After a bit of experimenting, I sucessfully added my own menu exactly where I wanted it and with my colors.  Works Great!

Mike