简体   繁体   中英

How can i check if an item is part of a specific menu [Joomla 3.3]

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

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'

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM