Reputation: 332
i already know how to parse id/name and stuff from my current/active menu-item, but i want to know if it's part of a specific menu for example:
I have this Menu with the name "mainmenu" and type "mainmenu": Home | About | Contact | Testing
If i click on About i want to know if About is part of "mainmenu" - how can i do that?
like this:
$app = JFactory::getApplication();
$menu = $app->getMenu();
$activeitem = $menu->getActive()->id;
// And now the if-statement - which asks if activeitem is part of "mainmenu" and if yes do that, and if not do that...
I hope you know what i mean...
Thanks for any help
Upvotes: 0
Views: 87
Reputation: 7059
You can check menutype using below code -
$app = JFactory::getApplication();
$menu = $app->getMenu();
$menutype = $menu->getActive()->menutype;
if($menutype =='mainmenu'){//check if active menu part of 'mainmenu'
}
Upvotes: 1