Collapsible DHTML Menu Trees?

shoq - July 3, 2006 - 23:37

I was assuming Activemenus (Jstools) would make my sidebar menus collapsible (Create Content, Administrate, etc), so I tabled this as a priority and went on to other task. But now it seems to only work with the primary navigation menu.

I cannot be the only one who wants collapsing block trees. Is there any module I can adapt, or a good open source tree that's at least partially adapted so I don't spend a week on this?

Addendum

shoq - July 4, 2006 - 00:39

Oklll duh.. Activemenu needed to be enabled as well as Jtools. Fine. They work great in firefox. They fail completely in IE6, and the issue tracker suggests safari fails too.

Is there no solution to this? Must I refresh very big pages every time a user changes menu items? Seems a bit rough for a CMS as mature as drupal.

Persian-theme does some similar

narres - July 4, 2006 - 18:51

Um.. it does?

shoq - July 5, 2006 - 02:14

Narres.. perhaps I wasnt'; clear. I see no demo of a collapsing block/nav menu anywhere at that site. Persian is a very simple, single column theme and has no tree type navigation of any kind. I looking for a collapsible nav tree like activemenu, but that works cross-browser. Activemenu only seems to behave in Firefox

persian and internet_jobs theme

narres - July 5, 2006 - 05:43

Persian shows a non reloading menu on the top-navigation.

If you want to design your own html-sequence for menu, you may do it like the internet_jobs theme:

<?php
function phptemplate_menu_tree($pid = 1) {
  if (
$tree = menu_tree($pid)) {
   
$output .= "<ul class=\"menu-tree\">";
   
$output .= $tree;
   
$output .= "</ul>";
    return
$output;
  }
}
function
phptemplate_menu_item($mid, $children = '', $leaf = TRUE) {
 
//return '<li class="'. ($leaf ? 'leaf' : ($children ? 'expanded' : 'collapsed')) .'">'. menu_item_link($mid) . $children ."</li>\n";
 
return '<li>'. menu_item_link($mid) . $children ."</li>";
}
?>

Doing it in this way, you are able to customize your menu for your likings.

non reloading menu

psr - July 6, 2006 - 00:34

where would this bit of code go? please specific in which file and between 'this item in the code' and 'that item in the code'

thank you
peter

I also was disappointed by activemenus, just a little weak and the reloading thing was the deal killer.

template.php

narres - July 6, 2006 - 05:42

As very well described on http://drupal.org/node/45471 the file template.php in your themes directory is the responsible one.

An easy way to try out how this works would be to install the internet_job-theme and have a look into the source and see how it works.

I am not making a drop down menu

shoq - July 9, 2006 - 13:57

Narres. The activemenus and the persian example are for pull downs, and i want to build a vertical "tree" menu (like the drupal admin and content menus) where each menu level is collapsible.

Are you suggesting with your example above, that I simply build my own collapsible source and code the javascript from scratch? That's not a trivial task, which is why I was looking for some module that did it. I find it very hard to believe that with the popularity of such trees all over the internet, that one of these gifted module writers has not done this already. If I had to do it myself, I will probably do as you suggest with the source, and used Dojo widget for the javascript, but I was sure hoping there was something off the shelf i could use. I am still not convinced there isn't. I just cannot be the only drupal user to want this basic widget code. Perhaps someone has written the base code already. If so, I would try and turn it into a module.

Not displaying in IE6

Acert93 - July 6, 2006 - 12:22

Hello narres,

Just wanted to let you know that your drop down menu works for me in FF but not in IE6. The body is also below the right column in IE6 as well and you have to scroll down to begin reading the content. Gotta love IE...

You are right

narres - July 6, 2006 - 14:39

that this doesn't work in IE. You are wrong, cause it isn't my template ;)

The nonworking IE for persian-theme may cause in the fact that it isn't multisite-able. On a multisite installation you get "themes/persian/drop_down.js" not found.

What I wanted to show is not a ready to use theme, but how you are able to realize one.

Keep the sunny side up

Opps!

Acert93 - July 7, 2006 - 11:57

My apologies! /puts tail firmly between legs

 
 

Drupal is a registered trademark of Dries Buytaert.