I have seen many modules trying to do different things: "slice", "trim", "block", but none is exactly what I'm looking for, and worst, I don't know how to implement it with a DHTML menu since I only see DHTML menus for a whole menu on the blocks section.

What I mean is: it would be cool to build block with a custom DHTML menu choosing which menu and from which level to which level instead that cloning all whole menus. Wouldn't it be cool?

Comments

dmsmidt’s picture

I would really like something like that.

The 'from which level to which level' part is already covered by the module 'local menu'. 'Submenu Tree' can also do nice stuff.

In general I'd like to see an option to add the DTHML menu effects to any block menu output. For example I have a block with a menu generated by the 'local menu' module. Just like in the options for a regular menu blocks, I'd like to see the checkbox 'Use the DHTML effect', for the custom module generated menu block.

I'd like to do it myself, but I'm just not capable enough to do it. Maybe someone can give me any tips?

(I would want it for the 6.x version)

cburschka’s picture

add the DTHML menu effects to any block menu output. For example I have a block with a menu generated by the 'local menu' module. Just like in the options for a regular menu blocks, I'd like to see the checkbox 'Use the DHTML effect', for the custom module generated menu block.

Pretty much impossible right now. Drupal 6 may have cleared up the menu rendering system, and nearly any module that generates menus now uses menu_tree_output, but that function cannot be hooked into. dhtml_menu has to replace the actual block content with its own, and it can only do that because it knows how the blocks owned by menu.module are constructed. To do the same for local_menu and book and all the others, it would need to be bloated with specific code for each of these, which is not feasible...

Gauss1777’s picture

'local menu' is just for Drupal 6 :(
Right now I'm using a lot of Drupal 5 modules so is not an option... for now.

cburschka’s picture

In general, any other module can be updated to use the dhtml menu effect very easily in two steps:

1.) Replace "$tree = menu_tree_page_data()" with "$tree = menu_tree_all_data()". This will load the entire menu tree, including non-expanded paths.
2.) Replace "menu_tree_output($tree)" with "theme('dhtml_menu_tree', $tree)". This will render the menu with DHTML.

Unfortunately, the Drupal hook system does not yet allow a way to do this from inside dhtml_menu without changing other code files, as menu_tree_page_data and menu_tree_output cannot be overridden. If it ever does, you can be sure this will be added. Until then, other addons will have to interface with dhtml_menu explicitly to use it.

cburschka’s picture

Version: 5.x-1.3 » 6.x-2.x-dev

Issue queue clean-up: Feature requests must be in the development branch.

Gauss1777’s picture

Version: 6.x-2.x-dev » 5.x-1.5
Category: feature » support

Thanks for the info. Just one question. Is this method for Drupal 6?

BTW. I'm using 'Block Menu' module for Drupal 5 which now does what I needed. Was recently updated. I think it does the same that 'Local Menu', but now we have an option for Drupal 5.

I didn't found those functions on this module. I'm trying to figure out how to add the DHTML menu to this module, any advice is welcome.

Anyway I'll make a petition to JohnAlbin (creator of Block Menu) to see how.

Thanks again for your support!

cburschka’s picture

Version: 5.x-1.5 » 6.x-3.x-dev
Status: Active » Closed (won't fix)

I haven't found this module as "block_menu" or "blockmenu", so I don't know what it does. If it prints raw HTML, it cannot work with dhtml_menu by definition.

6.x-3.x works with all modules that call menu_tree_output (which includes book navigation) without having to modify any code. This has been made possible by the API of Drupal 6 and cannot be backported.

In summary, please don't ask me for features on D5. I know it takes time and effort to upgrade your site to D6, and you may be waiting for themes and modules to become compatible, but you are going to have to upgrade eventually because support and security updates won't be provided eternally.

I'm sorry to brush you off like that, but every feature I haphazardly slap on an outdated module, working with an outdated API, is essentially me working to postpone the time you have to inevitably upgrade your site. ;)

johnalbin’s picture

Arancaytar, the module is called Menu block.

And, since Drupal doesn't allow me to hook into/override menu_tree_output (which you pointed out earlier), Menu block 6.x uses a slightly modified version of that function to add additional classes. And, yet, DHTML Menu still hooks into Menu block's blocks! Yay! I see you are doing your magic by overriding theme_menu_item and theme_menu_item_link. Good thing I didn't do that too! :-) I love no-work integration.

There are some minor issues I see with 6.x-3.x-dev, but it is a beta version. :-) I'll post what I see in a separate issue.