Active sub menu item

in Menu_Rendering, I add 3 sub menu with $menu->addMenuItem function.
my submenu url are:

  • racklist.php?x_site_id=1
  • racklist.php?x_site_id=2
  • racklist.php?x_site_id=3

when i click on the menu and go to racklist.php?x_site_id=X page, all sub menu marked as active (with blue background) and the url of all set to # and user can not click on it!

You may use MenuItem_Adding server event (see the topic Server Events and Client Scripts in the help file) to check the CurrentUrl() and compare with $item->Url property, then set the $item->Active property accordingly.

I add this code:

function MenuItem_Adding($item) {
if(substr( $item->url, 0, 12 ) == “racklist.php” && $item->url != CurrentUrl()) $item->Active=FALSE;
return TRUE;
}

But it doesn’t work!
when i go to ‘racklist.php?x_site_id=1’, in view-source I see this code: (as you see all href set to # for my sub menu!!! before page generation

solution: $isCustomUrl = true