menu

Drupal: dealing with nested children that share their parent's path

Let's say that you'd like to create a nested menu in which one of the children links to the same path as its parent. Something like:

  •  people/friends
    • people/friends
    • people/family
    • people/neighbors

This works in theory-- the menu items will take you to the correct page. But if you're relying on Drupal to correctly set the active trail and expand the correct sub menus, you'll have to use a bit of a workaround. You're basically going to create dummy nodes that will redirect to the desired page rather than creating two menu links that have the exact same path. The parent (in menu) will redirect to the child's node.

Creating a dynamic menu link in Drupal

Sometimes you'll need to create a menu link that is different for each user that views it. The simplest way to do this is to create a small custom module that will add the menu link and generate a dynamic URL.

In my case, I wanted a link title 'My Company' that would redirect the user to their own Organic Group.

What to do

<

ul>

  • Create a menu entry
  • Drupal View: shows teasers of all menu children for current node

    I tossed around a lot of strategies for accomplishing this, and in the end I managed to find a module that does most of the hard work for me.

    Goal

    To create a node which displays the teasers of all its menu children (other nodes nested under current node's menu entry).

    Using lightbox2 with the core menu system

    If you'd like to make a menu item open in a lightbox, you can use the Lightbox2 module in tandem with the Menu Attributes module module to achieve a variety of effects.

    Download and enable the Menu Attributes module.

    This will let you add a rel attribute to any menu item. Add "lightframe" or one of the following rel values (as appropriate):

    Subscribe to RSS - menu