It seems as though 4.7 wants to make a move in this direction, but I'm unsure how to implement it programmatically in my template. I would like any sub-menu links of the primary links menu to display when the menu item is clicked.

Comments

Lil Devil’s picture

I was recently trying to do exactly what you ask, then I found the Nice Menus module. Place a block at the top and use drop-down menus.

solipsist’s picture

Did you try making a two level menu, set it as Primary Links as well as Secondary Links in menu settings? Doing so will make Drupal display the children of the first level items when they're clicked. I used that technique here:
http://www.sjutjugo.se

Cheers,

--
Jakob Persson
Drupal developer, web designer and usability consultant
http://www.jakob-persson.com

--
Jakob Persson - blog
Leancept – Digital effect and innovation agency

jaarong’s picture

That's exactly what I want to do. What kind of PHP code does it take to do this?

Gamecron Gaming

solipsist’s picture

None! Just do what I wrote above. :)

--
Jakob Persson
Drupal developer, web designer and usability consultant
http://www.jakob-persson.com

--
Jakob Persson - blog
Leancept – Digital effect and innovation agency

zucker-1’s picture

I tried this - My menu settings specify that Primary Links and Secondary Links are both contained within the menu 'Primary Links'. I then set up several Primary Links. (i.e. 'Home' 'About').

Each primary link contains a secondary link (i.e. 'About Us' has the parent of Primary Link 'Home', 'Our Company' has the parent of Primary Link 'About').

The first Primary Link shows no Secondary Links - each subsequent Primary link shows the exact same Secondary Links. In other words, there is no relationship between the Primary and Secondary links. The same two Secondary links display, no matter which Primary Link I click on - and NO Secondary Links show up when the first Primary Link is clicked.

mblazke’s picture

Hi zucker,
did you resolve it?
My Drupal 5.1 works exactly as bad as you've described....

zucker-1’s picture

Nope, I never got this to work. I think I'll take a look at nice menus mentioned above. I did use a technique described in the Showcase Forum to get a secondary menu at http://www.noregifting.com. The only main link that currently has secondary links is 'How It Works'...

adrienf’s picture

Could you please give us a link to this article you are talking about?
Thanks!

zucker-1’s picture

In the showcase forum, go here: http://drupal.org/node/110343

There are many comments, so you'll have to scroll down. He provided a link to the site where the menu can be found: http://www.dynamicdrive.com/dynamicindex17/tabcontent2.htm

When I went there, it didn't seem to be exactly the same menu. If you view his page source, it makes it a little easier to understand how to configure: http://www.artistshousemusic.com

zirafi’s picture

Hi,

I searched many links so far and i could not get right thread that matches to my requirement. Many of them explain with code snippets. While i was searching more, i got this thread and i am looking for help to configure the menu links something like this in this site.

http://www.sjutjugo.se/

Could some one help me how to configure the secondary links under primary links. I already tried the following steps so far.

Administer > Menus > : Created Primary Links and Secondary links as Menus
Administer > Menus > Settings : All the drop down lists are pointing to Primary links.

Thanks,
Paradesi

solipsist’s picture

If it's of any help to you, here's the relevant code from that site. It runs Drupal 4.7.

In your theme:
page.tpl
...

<div id="primary-links">
  <?php if (isset($primary_links)) { print theme('links', $primary_links); } ?>
</div>
<div id="secondary-links">
  <?php if (isset($secondary_links)) { print theme('links', $secondary_links); } ?>
</div>

Then make a menu with at least two levels, a menu tree, like this:

one
+ ape
+ banana
+ crocodile

two
+ dolphin
+ elephant
+ fruit

three
+ grate
+ haystack
+ imp

Finally set both Primary and Secondary Links to the menu you just made.

Now when you click "two", the second level will display: "dolphin, elephant, fruit".

Since it's been a while since I built that site I just checked and there are no extra functions in template.php for this to work.

--
Jakob Persson
Drupal developer, web designer and usability consultant
http://www.jakob-persson.com

--
Jakob Persson - blog
Leancept – Digital effect and innovation agency

zirafi’s picture

Hi,

I added the above code snippet to page.tpl.php file for the selected theme (aberdeen). But i see the same primary links appeared in place of secondary links as duplicate links even though primary links are already available in original position. Finally i see two sets of primary links in both the places. Is there any other fix for this ?

Thanks,
Ram

benediktevdw’s picture

Bene - www.bene.be

I wonder if you want to create your menu first, I mean, do you have already made your content, your pages or stories, etc...?
I was having the same problem, but I found out that if you create your pages first, so like in the example above:

- colors (create a page and call it colors or something like that)
-- blue (create a page and call it blue)
-- red (same)
-- green (same)

now, return to your menu and in the path field, enter the name of the page you want your menu item to point to, if the page is unique, Drupal will show the secondary level of links in your primary link bar.
It is just beginning to work, so I have a lot to discover myself...

zirafi’s picture

Hi,

I got the secondary links working, but are they not supposed to show up for non members of the site?

Here is my sample site: www.paradesi.net

Thanks,
Paradesi

pvanderspek’s picture

I'm having the same problem. It looks like it works but non-members don't get to see the the secondary links. If anyone knows how to solve this, please explain what that solution is.

zirafi’s picture

Hi,

Could you share the solution for this?

Thanks
Paradesi