This tutorial explains about how to get the active menu item properties in joomla. This method is very much useful for those who want to have some conditional statements to be executed in the template depends on the current menu item property values.
The following syntax gets the current menu name:
$currentMenuName = JSite::getMenu()->getActive()->name ;
The following syntax gets the current menu Id:
$currentMenuId = JSite::getMenu()->getActive()->id ;
The following syntax gets the current menu status, published values (It will be 1 if published):
$currentMenuStatus = JSite::getMenu()->getActive()->published ;
The following syntax gets the non-Seo friendly URL of the current menu :
$currentMenuLink = JSite::getMenu()->getActive()->link ;
The following syntax gets the current Menu’s parent Menu item ID (For top level and the home page the value will be 0):
$currentMenuParent = JSite::getMenu()->getActive()->parent ;
The following syntax gets the current Menu’s Access Level Value.(Public = 0, Registered = 1, Special= 2)
$currentMenuAccess = JSite::getMenu()->getActive()->access ;