Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:45

open specific menu by url


Poster: HCBen
Dated: Thursday May 5 2005 - 14:46:36 BST

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


Poster: Ruth
Dated: Thursday May 5 2005 - 22:18:41 BST

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


Poster: HCBen
Dated: Thursday May 5 2005 - 22:27:57 BST

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


Poster: Ruth
Dated: Saturday May 7 2005 - 7:46:13 BST

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


Poster: HCBen
Dated: Monday May 9 2005 - 16:02:27 BST

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:
//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.


Poster: Ruth
Dated: Monday May 9 2005 - 16:49:23 BST

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