Is it possible to have multiple menus in some sort of "group" ?

Im trying to set up a menu like this:

Header 1
- menu item
- menu item
- menu item
Header 2
- menu item
- menu item
- menu item
Header 3
- menu item
- menu item
- menu item

Where the "headers" are not links, but just a text header.

I am able to do this to just one section using the "menu title" as the header, but it appears that each item in the menu must have a link.
so i cannot create the menu using "menu items" as the header and "sub items" as the main links in the menu, and having the tree always expanded. (or can i)

Is the best approach to have 3 separate menus that display in the column?
I would have about 10 of these menu groups (each containing 3 or 4 headers and their sub items) that would be displayed depending on the section the user is in (my section is based on taxonomy).
But i would like to be able to target these menus as a group and not have to include 3 or 4 menus for each 'section'

does this make any sense?

Comments

loze’s picture

Alright,
so i think im going to just make each 'section' of the larger menu as its own menu, and display them with block visibility depending on a taxonomy term

The potential problem i see here is that im going to end up with around 100 separate menus (20 sections, 5 menus for each) and it will be hard to manage them all let alone do the conditional visibility logic for each one.

also some may have the same title and will be hard to distinguish for the admin.

can anyone think of a better way to do this?

thanks

JohnColeman’s picture

Hi Loze,

did you get a good answer to this? I would like to find one too. At present I am reduced to making each 'header' a link to the home page, so it effectively does nothing, and hopefully users quickly learn not to bother with it.

But that's a pretty horrid kludge, am I missing the simple way of doing it elegantly ?

Thanks

John

Santhos’s picture

Hi guys, i'm quite curious how to answer this topic as well, therefore i bump it so that i don't double post

loze’s picture

What I ended up doing, was create a custom module, that provides a new cck field.
when included in a custom content type (im calling mine 'navigation') it provides the following fields as a compound form element.

link title: (text field)
link url: (text field)
link help: (text field)
is header: (checkbox)
nofollow: (checkbox)
_blank: (checkbox)

clicking on the "is header" check box hides the url, help, target, and rel fields. (with javascript) and sets the css class of the title field to .header so i can style header fields differently and have them stand out on the node edit/add form.

i include one instance of this field type in my custom node.
so my custom content type has the following fields only (although it could have others):

title (core)
sub-navigation (my custom cck field element, set to multiple values)

I then use the "Node Blocks" module (http://drupal.org/project/nodeblock) to create a block for each of these "navigation nodes" i make. and include them as needed through the block settings page.

create a custom theme for this block, or this node type. to style the links and headers how you want.

Drawbacks:
these 'node menus', are not a part of the core menu system at all. they are simply a list of links stored in a node. so none of the core menu's parent/child functionality and other good stuff are available. The module does no checking if the link actually exists, and that's up to the editor to make sure that its a valid url, or the viewer has access permission to that url.

Upsides:
the editor doesn't need menu editing permission, just permission to create/edit this node type
all the link items are on one screen, so it greatly reduces the number clicks and pages loads needed to set up a new menu from scratch, and makes it much quicker to do.

I don't use this for my primary navigation, just for sub menus within a section.
here is a screenshot of the module in use, on the node edit page: http://lohze.com/images/cck-nav.gif

What i still haven't figured out to do is how to throw a 404 when someone tries to view this node directly, because its not really intended to be viewed alone, but as a block.

I would contribute this mod if people think they would like to use it, but it was my first attempt at coding a module and its not up do Drupal standards, and some things are hardcoded in there for my specific scenario. one day i will try to clean it up and share. Id be happy to contribute it if someone wants to maintain it (i can help periodically) but i don't have the time to fully support it.

As i said, this was my first module attempt, and I don't know if its a wise choice to do it this way, the site it was intended for is not live yet, so id appreciate your feedback.

thanks

Santhos’s picture

Thanks for the information. I still don't really understand why the core doesn't support it. I guess it's a quite usual request (having headers in menu).

I'm absolute beginner, atm I'm setting up my first website using Drupal. I think I can't tell you whether it's good or bad. So far it's seems quite complicated for such a basic/easy task.

I'll be working on a different part of the web now and search the forum better to obtain more information about this problem. I'd be very surprised if we were the first seeking the solution. I'll post here if I find anything positive.

helior’s picture

Alternatively, you can use jQuery to remove the link from the parent menu item and replace it with a header tag. Here's what it looks like (your selector may vary)

$(document).ready(function(){
        $("#block-menu-primary-links .expanded > a").each(function(){
                $(this).replaceWith("<h3>" + $(this).text() + "</h3>")
        })
});

Hopefully this method is a little more practical for some users.