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:15

regexmatch problem


Poster: bgr
Dated: Wednesday October 22 2008 - 0:20:45 BST

I hope you can help me with this: We would like to set a special background color not only the current page's menu uten, but also to all its parent(s) menu item(s).

So, for example, in my Main Menu, I have a menu item called 'Barbara', which has a child menu called 'Barbara1', which has another child called 'Barbara2'. If the user is on the Barbara2 page, we want to see a different background color for all THREE menu items, i.e. Barbara, Barbara1 and Barbara2.

Here is my code:

Code:
fixMozillaZIndex=true; //Fixes Z-Index problem  with Mozilla browsers but causes odd scrolling problem, toggle to see if it helps
_menuCloseDelay=500;
_menuOpenDelay=150;
_subOffsetTop=0;
_subOffsetLeft=0;
buildAfterLoad=true;
with(menuStyle=new mm_style()){
fontfamily='Lucida Sans Unicode','Lucida Grande','Lucida Sans','Tahoma',"Arial","Verdana";
fontsize="100%";
fontstyle="normal";
headerbgcolor="#ffffff";
headercolor="#fff";
menubgimage="http://localhost:8080/roostMortgage-theme/images/navigation/bg.png";
offbgcolor="transparent";
offcolor="#fff";
onbgcolor="black";
oncolor="#fff";
outfilter="randomdissolve(duration=0.3)";
overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color=#777777', Direction=135, Strength=5)";
padding=5;
pagebgcolor="#AF1E2D";
pagecolor="#fff";
}
with(menuDropStyle=new mm_style()){
fontfamily='Lucida Sans Unicode','Lucida Grande','Lucida Sans','Tahoma',"Arial","Verdana";
fontsize="100%";
fontstyle="normal";
headerbgcolor="#ffffff";
headercolor="#fff";
offbgcolor="#c5c6c2";
offcolor="#fff";
onbgcolor="black";
oncolor="#fff";
outfilter="randomdissolve(duration=0.3)";
overfilter="Fade(duration=0.2);Alpha(opacity=100);Shadow(color=#777777', Direction=135, Strength=3)";
padding=5;
pagebgcolor="#AF1E2D";
pagecolor="#fff";
}
with(milonic=new menuname("Main Menu")){
alwaysvisible=1;
position="relative";
orientation="horizontal";
style=menuStyle;
menuwidth=800;
menuheight=25;
aI("showmenu=Barbara;text=Barbara;url=/web/guest/25;regexmatch=^(/web/guest/25)$;");
}
         
           
with(milonic=new menuname("Barbara")){
overflow="scroll";
style=menuDropStyle;
aI("showmenu=Barbara1;text=Barbara1;url=/web/guest/26;regexmatch=^(/web/guest/25|/web/guest/26)$;");
}   
   
with(milonic=new menuname("Barbara1")){
overflow="scroll";
style=menuDropStyle;
aI("text=Barbara2;url=/web/guest/27;regexmatch=^(/web/guest/25|/web/guest/26|/web/guest/27)$;"); 
                
}
     
drawMenus();



So I have set the pagebgcolor in the style to get the background color I want. I also try to use the item's regexmatch property, but I guess I am not doing this correctly: This regular expression:

^(/web/guest/25|/web/guest/26|/web/guest/27)$

should match pages 25, 26 and 27 (aka Barbara, Barbara1 and Barbara2), but only page Barbara2 has the desired background color.

I'm using (a licensed) Version 5.803.

Re: regexmatch problem


Poster: Ruth
Dated: Wednesday October 22 2008 - 5:46:18 BST

Hi,

That is automatic in the menu if you've set the pagebgcolor for the style used in the submenus.

For example, if you click on main item Barbara, then Barbara will highlight. If you click on the main item Barbara submenu item Barbara1 and go to that page, then Barbara and Barbara1 will highlight. If you click on the sub sub menu Barbara2, then Barbara, Barbara1 and Barbara2 will all highlight. If that is not happening I will have to see the page on the web to see what's going on.

Ruth

Re: regexmatch problem


Poster: Andy
Dated: Wednesday October 22 2008 - 12:11:36 BST

I think pagebgimage should be what is needed here.

Note that the regexmatch property is only for matching urls for a single menu item, not sure how it will work for more than one menu item as its never been tested.