With URL Params - no highlighting in menu

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
jdsturgill
Beginner
Beginner
Posts: 3
Joined: Thu Oct 02, 2003 5:35 pm

With URL Params - no highlighting in menu

Post by jdsturgill »

I'm brand new to Milonic so this may be a stupid question.

When I go to a particular page that is in the menu - the menu highlights to let people know what page they are on.

That's groovy.

However, if I go to that same page with a URL parameter - the menu does not highlight.

Question: Is it possible to tell the menu system to ignore the URL parameters and highlight the menu item regardless of the existence or value of the URL parameters?
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

What are you defining as 'a URL parameter'? To me that can mean many things.

Always best to post a URL, as requested, so we can see the problem and look at your code at the same time.
John
bzeitner
Super Advanced
Super Advanced
Posts: 32
Joined: Thu Oct 02, 2003 6:02 pm

Post by bzeitner »

I take it he means the ?item=value portion of a URL, ie <a href="/dir1/page1.asp?item=value">link</a>
jdsturgill
Beginner
Beginner
Posts: 3
Joined: Thu Oct 02, 2003 5:35 pm

Post by jdsturgill »

These URLs are internal - so you will not be able to see the page - but here's the skinnny.

With the following URL - the menu item for Shipping is highlighted.
http://webdevnew/shoppingCart/admin/shipping.cfm

With the following URL - the menu item for Shipping is not highlighted
http://webdevnew/shoppingCart/admin/shi ... pping_id=2
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

If webdevnew is the root of your site, try

/shoppingCart/admin/shipping.cfm

/shoppingCart/admin/shipping.cfm?shipping_id=2

as your urls. The forward slash at the beginning tells it to look in your root and start from there.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
jdsturgill
Beginner
Beginner
Posts: 3
Joined: Thu Oct 02, 2003 5:35 pm

Post by jdsturgill »

I'm may be slightly confused.

Are you suggesting that I add 2 menu items for shipping? One with and one without the URL Parameter?

I only want to have "Shipping Methods" to show up once in the Menu. However, this page will often be called with a URL Param to specify a particular shipping method. Ideally, I'd like Shipping Methods Navigation to highlight with or without a URL Parameter.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

No no no, I meant you have this as a menu item url...

http://webdevnew/shoppingCart/admin/shipping.cfm

change it this to see if it works...

/shoppingCart/admin/shipping.cfm

And then you can add the querystring to it to see if it works. Just remove the root name, thats all I was sayin.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
halcyon
Advanced
Advanced
Posts: 22
Joined: Wed Oct 08, 2003 9:43 pm
Contact:

Post by halcyon »

I am having the same problem. When my url is:

/salesweb/viewFlexReferencesQuery.do
it matches it no problem and highlights it accordingly

however when I modify my query and it looks like
/salesweb/viewFlexReferencesQuery.do?sort=name&order=ASC
it is no longer highlighting it.

Code: Select all

with(milonic=new menuname("References")){
	left="0";
	itemwidth="133";
	style=menuStyle;
	alwaysvisible="1";
	orientation="vertical";
	position="relative";
aI("text=New Query;url=/salesweb/showFlexReferencesQuery.do;");
aI("text=View References;url=/salesweb/viewFlexReferencesQuery.do;");
aI("text=Add Reference;url=/salesweb/addNewFlexReference.do;");
}
Any ideas?
bzeitner
Super Advanced
Super Advanced
Posts: 32
Joined: Thu Oct 02, 2003 6:02 pm

Post by bzeitner »

This is definitely a feature that needs to be implemented or, if implemented, a bug that needs to be fixed.

I use querystring's extensively- It helps consolidate code and provides an easier to manage interface. But the menu will not highlight the current page if the URL doesn't EXACTLY match what's in the menu.

Could the menu be setup to ignore the querystring (the ? and everything after it)?
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

We had a problem a few weeks ago where an & in the URL was dropping the rest of the query. I know, not quite the same as here, but the fix was to use the entity instead of the actual character. In this case that would be %63.

Left field stab probably, but what the heck...
John
bzeitner
Super Advanced
Super Advanced
Posts: 32
Joined: Thu Oct 02, 2003 6:02 pm

Post by bzeitner »

I was following that topic, and it was noted. But this is a separate issue, and besides, I've already tried URL encoding ;)

The issue is that the menu, when it compares URLs to determine whether or not the currently viewed page is in the menu, doesn't take into account for the added info from a querystring. It doesn't know that index.asp?item=value (current page) is essentially the same as index.asp (menu item) unless the menu item is set to exactly index.asp?item=value.

Perhaps it could be added that the menu evaluate the current page's url, and if nothing in the menu matches it, and there is a querystring, then it remove the querystring and then evaluate if anything matches. Then, the menu could continue on it's merry way.

Am I making sense?
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

bzeitner wrote:Am I making sense?
Yep, except the final on this will have to come from Andy.
John
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

From what I THOUGHT the menu did, was use a javascript function known as MATCH. What match does is takes a string and searches for an instance of it in another string, anywhere in it. So if you have two menu items, one with URL = page.asp?var1=item and another with URL = page.asp..... if you go to page.asp, both should be highlighted, but if you go to the one with the querystring, only one SHOULD be highlighted (the one with the querystring). But this sounds likes it flubbing on the latter case. Andy, any insight?
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
halcyon
Advanced
Advanced
Posts: 22
Joined: Wed Oct 08, 2003 9:43 pm
Contact:

Post by halcyon »

Any update on this bug? Still exists with latest RC... please fix!!
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Patience. Lots going on right now, and Andy is working on things as fast as he can. Expect to see a darn-near-final-if-not-final in the next few days.
John
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

What you are seeing is actually by design.

If you had several files all with query_strings and you highlighted them based on just the file name, they would all show up.

I can't see this being useful though. We might be able to add a flag or something, would this help?

Cheers
Andy
halcyon
Advanced
Advanced
Posts: 22
Joined: Wed Oct 08, 2003 9:43 pm
Contact:

Post by halcyon »

Thanks for the reply Andy, let me make it a little more clear what the current behavior is and what the desired behavior is.

URL Current Desired
/viewFlexReferencesQuery.do highlighted highlighted
/viewFlexReferencesQuery.do?sort=name not-highlighted highlighted

Make sense? If that is the intended behavior if you could make an option to match only the file name and ignore url parameters that would be great too.

Thanks,
David
halcyon
Advanced
Advanced
Posts: 22
Joined: Wed Oct 08, 2003 9:43 pm
Contact:

Post by halcyon »

In fact I'll give you the example of where this is in use at on our site. There is a menu item for "View Query" which is a query on some database stuff. Well after the query is loaded the user can click on the table headers to sort that information which will reload that file with url parameters. However they are still Viewing a Query, and we don't have seperate menu items to sort the data because that depends on how many columns are returned etc, so we still want the 'View Query' menu item lit up on the left side.

Thanks,
David
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

I may be completely off on this, but might be worth mentioning.

I had a problem validating my site for xhtml, turned out php needed to change & to *& a m p ; so I had to make a htaccess for it. I changed all the page links to reflect this change. But the menu links didn't work when I changed them to *& a m p ; and I had to change them back to &. Now it validates and works perfectly.

Maybe there is a way of changing something, but the menu reads it different?

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

Post by Hergio »

I think a flag or variable set at the top of the menu_data file or maybe even inside of the style (so its a per menu type of thing?) woulod be good. That way you can have alittle bit more granular control over what gets highlighted and what doesn't. I see David's point, in sites where there is alot of data (like intranets) sorting is a very common occurance and queryString variables are common and it'd be nice if they didn't interfer with the nice features presented by the menu.

Don't know if/when it would get in there, but since there are a couple other important things still to get done, might have to wait a short while, but Andy always comes through for his customers.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply