Solved

How do I programmatically expand a Drupal 6 navigation menu entry?

Posted on 2010-08-15
5
598 Views
Last Modified: 2012-05-10
I have written a custom module that creates several top level entries in the navigation menu.  When a user selects one of these entries and navigates into it, the menu tree is expanded as selections are made.  However, selecting an entry that creates, views or edits a node, causes Drupal to redirect to "/node/xxx" or "/node/xxx/edit".  This results in the custom navigation menu tree collapsing, so that the user has to re-navigate it again to select another entry.

I can mark the menu entries as permanently expanded, but then the navigation menu is too busy as the trees show on all pages whether the user is using that function or not.

Are there any mechanisms to programmatically expand a menu item so that the relevant menu tree remains visible when the user has been re-directed away?

Thanks
0
Comment
Question by:jayelless
  • 3
5 Comments
 
LVL 17

Expert Comment

by:Thomas4019
ID: 33446403
This modules not perfect, http://drupal.org/project/dhtml_menu, but might help.
0
 

Author Comment

by:jayelless
ID: 33449613
Thanks for pointing out that module.  It looks as though it may do some of what I am wanting, but is not the approach I was hoping to be able to take.  For performance reasons, I am trying to keep the amount of javascript deployed with each page to a minimum.

I am hoping that someone might know of some variables that can be set programmatically that will cause the Drupal rendering routines to expand a particular menu item.  When the item is selected via normal navigation, Drupal knows to expand it, so there should be a setting somewhere that controls this behaviour.

Regards
0
 
LVL 2

Accepted Solution

by:
TheChemic earned 125 total points
ID: 33492845
I dont know much about custom drupal modules.  However, I solved a similar problem myself.  I have several tabs and I wanted drupal to remember the last tab a user had viewed.  Each time the user would visit a page with those tabs, his "last viewed tab" would be selected and open by default.

I just created a custom session variable and stored the "last tab" info into it, then and hard coded the script into a template file.  I did not create a module.  This is not the "drupal way" but it worked just fine for me.
0
 

Author Comment

by:jayelless
ID: 33493057
Thanks for the suggestion.  It is an approach I have not yet considered, but it seems to be an approach that fits with my objectives, so I will explore this idea to find a solution to my problem.

Regards,
0
 

Author Closing Comment

by:jayelless
ID: 33493058
Maybe my question was too difficult or not well expressed.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now