PHP and Javascript dropdown menu

Started by MonoTiz, March 30, 2008, 06:39:04 AM

Previous topic - Next topic

MonoTiz

Hi,
I would like to create a drop-down menu multilevel like those used in the SMF 2.0 admin panel.

How can I do?

Thanks.

Dannii

"Never imagine yourself not to be otherwise than what it might appear to others that what you were or might have been was not otherwise than what you had been would have appeared to them to be otherwise."

MonoTiz

#2
Quote from: Dannii on March 30, 2008, 06:53:14 AM
http://www.alistapart.com/articles/dropdowns/
I try to mix the code in Genericmenu.template.php and the code in the quote link, but not work...


echo '<td>';
// Which menu are we rendering?
$context['cur_menu_id'] = isset($context['cur_menu_id']) ? $context['cur_menu_id'] + 1 : 1;
$menu_context = &$context['menu_data_' . $context['cur_menu_id']];

echo '
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/scripts/menu.js"></script>';


echo '
<div id="adm_container">
<ul class="admin_menu" id="dropdown_menu_', $context['cur_menu_id'], '">

  <li class="chosen">Sunfishes
    <ul>
      <li><a href="">Blackbanded»
        sunfish</a></li>
      <li><a href="">Shadow bass</a></li>
      <li><a href="">Ozark bass</a></li>
      <li><a href="">White crappie</a></li>
</ul>
</li>

  <li class="chosen">Grunts
    <ul>
      <li><a href="">Smallmouth grunt
        </a></li>
      <li><a href="">Burrito</a></li>
      <li><a href="">Pigfish</a></li>
    </ul>
  </li>

  <li class="chosen">Remoras
    <ul>
      <li><a href="">Whalesucker</a></li>
      <li><a href="">Marlinsucker</a></li>
      <li><a href="">Ceylonese remora</a></li>
      <li><a href="">Spearfish remora</a></li>
      <li><a href="">Slender suckerfish</a></li>
    </ul>
  </li>
</ul>
</div>

<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var menuHandle = new smfMenu("dropdown_menu_', $context['cur_menu_id'], '");
// ]]></script>';

echo '</td>';



EDIT: I forgot to insert this:
<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/dropmenu.css" />';

Now work but I must fix some problem...

ryanhellyer

#3
Sorry to bump the topic, but I stumbled across this post whilst looking for something else and it happens to be my area of expertise.

You may find the Dropdown menu generator in my signature of use. Just enter in what you want it to look like and it spits out the Suckerfish CSS for you. If you have any difficulties, feel free to leave a comment on my site where I provide free support for the generator (which is also free to use).

yol

Istanbul is Istanbul ;-)

Advertisement: