open specific menu by url

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
HCBen
Beginner
Beginner
Posts: 9
Joined: Thu May 05, 2005 2:28 pm
Contact:

open specific menu by url

Post by HCBen »

The menu bolt on Automatic Menu Opening Module works great if you only use a single menu on your site. However, I'm using two menus on every page: http://vault.hanover.edu/~stilson/hanover/about/

I need only the left-side collapsible menu to be automatically opened - not the header menu at the top.

Is there anyway to tweak this function to pass it a specific menu to use?

Better yet, to indicate which menu style to use so that it will work for all menus using the style?

Thanks!

Ben
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi,

I don't know that you could tweak it. I think the code would have to be re-written since the module was written to use the menu programming to open the submenus. It probably uses some of the internal programming that is there to make the page highlighting work. I wanted to respond so you didn't think we were just ignoring you :) But, it may not be possible, or it may be excessively time-consuming to try and 'tweak' the module.

Ruth
HCBen
Beginner
Beginner
Posts: 9
Joined: Thu May 05, 2005 2:28 pm
Contact:

Post by HCBen »

I always seem to end up using the Milonic menu in the most difficult or complicated ways ;)

Oh well. Thanks for your reply Ruth.

Ben
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

I was thinking about this and I had a thought that might work, it really depends on just how many pages you have and whether you want to use another directory. If you had a different directory for the treemenu pages and the main menu pages, openmenusbyurl would work exactly as you wanted it to work.

Ruth
HCBen
Beginner
Beginner
Posts: 9
Joined: Thu May 05, 2005 2:28 pm
Contact:

Post by HCBen »

Ruth,

I think I found a way to "cheat" the openmenusbyurl.js add-on to achieve what I want.

I don't fully understand how it works, but it seems to work perfectly. Here is the code:

Code: Select all

//function _ocURL()
function _ocURL(mnum) //my change
{
	
	var max_m = mnum; //added
	
	_ombcu=new Array()
	if(_cip.length>0){
		for(_c=0;_c<_cip.length;_c++){
			_ci=_cip[_c];
			_mni=getParentItemByItem(_ci);
			if(_mni==-1)_mni=_ci			
			if(_mni+" "!=$u){
				while(_mni!=-1){
					_ombcu[_ombcu.length]=_mni;
					_mni=getParentItemByItem(_mni);
					if(_mni+" "==$u)_mni=-1					
				}
			}
		}
	}
	
	if(_startM){
		//setTimeout("_ocURL()", 10)
		setTimeout("_ocURL("+max_m+")", 10)  //my change
	}
	
	else
	{
		if(_ombcu.length){
			for(_oma=_ombcu.length-1;_oma>-1;_oma--){
				
				if(_ombcu[_oma]>max_m){ //added
					
					_popi(_ombcu[_oma])
					clickAction(_ombcu[_oma])
				
				}//
				
				_ofMT=1
				if(_oma==_W.mm_maxLevels)return
			}
		}
	}
}
//_ocURL()
The function somehow counts all the menus on the page then loops over them all to determine which one to display. I haven't figured it out exactly, but if I limit the menu looping count to a certain number, I can get the function to work the way I want it to.

It's a hack, but it seems to work. I call the "_ocURL" function in the BODY tag with onLoad. I included a conditional statement to check if the number I pass in is greater then the main header menu count - if it's greater, then display the other menus.

It's ugly and as I said I don't fully understand it, but it works (for now).

What do you think?

Ben

PS. I'll try your suggestion today. Thanks.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Hi Ben,

:lol: It looks like Russian to me. I don't do any functions so it would have to be Andy or Kevin who took a look. I'll post and perhaps they can let you know if any problem might develop.


Ruth
Post Reply