Passing menu style parameters to a page

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
wendy
Beginner
Beginner
Posts: 4
Joined: Sat Aug 02, 2003 4:16 pm

Passing menu style parameters to a page

Post by wendy »

I don't know if this is possible, but I thought I would ask and see.

I would like to pass a variable to a page that contains a menu. This variable would turn the color of one of the menu items to green...so basically setting the oncolor parameter. This would save me having to make a separate menu for each page. The green color on the menu item helps the user to know which page they are on.

Any thoughts on this one?

Thanks

Wendy 8O
topachou
Advanced
Advanced
Posts: 24
Joined: Wed Aug 06, 2003 10:18 pm

Post by topachou »

Yes it's possible. I did it and it works.

Here what Andy told me :

Version 5.0 has quite a complex structure and many of the properties can be changed on the fly using the _m() and _mi() arrays.

The only difficult part is getting the reference number of each item or menu.

_m() is the array for menus and _mi() is the array for menu items. Each menu item is numbered from 0 to the number of menu items the menu has. Once you know the item number you can change any of the properties like this.

_mi[20][7]="red" will change the offbgcolor for menu item number 20. You may then need to execute the itemOff function to activate the change, this will be itemOff(20)

There is a full list of each of the menu item properties and the associated number at http://milonic.com/itemproperties.php

We hope to get a much more detailed demo of this posted soon.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

You could also utilize server side scripting. Given a parameter passed in, you could set a variable in ASP called vColor to a certain values, based on the parameter passed in. Then set oncolor to this value. I.e.

Code: Select all

<%
if( Request("param1") == 1 )
{
    vColor = "#00ff00";
}else if( Request("param1") == 2 )
{
    vColor = "#ff0000";
}else{
    vColor = "#0000ff";
}
%>

then in your menu_data.js file, it would be
....
oncolor = "<%=vColor%>";
....
Its not that hard if you've used ASP or PHP before. If you dont have such things available to you, your only bet is to go with what topachou mentioned, and get at the menu's innards.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
wendy
Beginner
Beginner
Posts: 4
Joined: Sat Aug 02, 2003 4:16 pm

Post by wendy »

Thanks so much guys! :D

I think the ASP technique would work well for me since I've written most of my database access code in ASP. I will give this a try and post back to let you know how it went.

Have either of you tried either the ASP or the integrated variable approach with your menus?


Wendy
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Yes i do it for permissions...
Basically I grab their user ID and then in the menu I say

Code: Select all

<%
if( 'adminBob' == Request.ServerVariables('LOGON') )
{
%>
aI("text=protectedStuff;url=....;");
<% }
%>
Its quick and dirty, but its until I get a SQL backend to render it.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply