2

I am using Drupal-7.

I have created Dropdown menu with Megamenu. Now, I wanted to create navigation menu on left side that menu items will be different on each page. I have created navigation block region for left side bar and wanted to create dynamic left side menu for each pages. For example:

If our page structure is:

1.0
1.1

    1.1.1

1.2
    1.2.1
1.3
    1.3.1
    1.3.2
    1.3.3
        1.3.3.1
    1.3.4
    1.3.5
    1.3.6

So, on 1.0 page on left side menu should appears like this:

1.0
    1.1
        1.1.1
1.2
    1.2.1
1.3
    1.3.1
    1.3.2
    1.3.3
        1.3.3.1
    1.3.4
    1.3.5
    1.3.6

On page 1.1 left side menu - It should be only - 1.1.1 On page 1.2 left side menu - It should be only - 1.2.1

On page 1.3, it should be like this:

1.3
    1.3.1
    1.3.2
    1.3.3
        1.3.3.1
    1.3.4
    1.3.5
    1.3.6

On page 1.3.1, 1.3.2, 1.3.4, 1.3.5 and 1.3.6 - no item on left sidebar.

On page 1.3.3 - only 1.3.3.1 should be there.

Can anyone please let me know that how should I create left side bar menu like this? Do I have to use Menu Block module for that? If I have to use Menu Block module then how do I create menu items that will be displayed different on each pages?

Thanks!

2 Answers 2

3

This totally looks like a Menu Block scenario, where you would want to enable the 'Make the starting level follow the active menu item.' setting. Also enable 'Block title as link', but don't enter a custom title as this would override the link.

1

Two options I can think of:

1) If you are not dealing with too many pages (3 in your example), create a separate menu for each page.

2) Create a custom module to build the menu items. This gives you more control over when a menu item is displayed, such as filtering by NID. Be sure the menu you want the items to show up in exists before your module creates the actual menu items.

The Example Menu Module may help: https://api.drupal.org/api/examples/menu_example%21menu_example.module/7

Edit: Another module that can get you part of the way is Menu Token: https://www.drupal.org/project/menu_token

Menu Token module provides tokens, that can be used in the title or the path of menu items (links). For example, if you create a menu item with the path: "user/[current-user:uid]", the URL will be changed "on the fly" to: "user/1" (assuming you are user 1).

Tokens are provided by the Token module. Menu Token enables you to use both global tokens and entity tokens (node, user, term, etc). Entity tokens have several methods of substitution, including context, random and user defined.

1
  • Thanks @acronym. We have total more than 200 pages in the site and 9 different sections(1.0, 2.0, 3.0 up to 9.0). Maximum number of pages are 14 in individual section which means, it will be upto (1.0, 1.1,1.2,1.3, .. upto 1.14.). Same applies for each section. So, I think it will be tricky if I would create any module as I am newbie in Drupal. I have created navigation menu with [drupal.org/project/menu_block] module. But it shows the same(all) menu items on each page. While I wanted to display only child elements on each page. Any solution? Thanks!
    – Vidushi
    Commented Dec 3, 2014 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.