Problem: How to get menu Itemid? or How to get active menu item properties in joomla?
To get menu “Itemid” use the following code
$menus = &JSite::getMenu(); $menu = $menus->getActive(); $itemid = $menu->id;
Source:
http://forum.joomla.org/viewtopic.php?p=1352138&sid=26b46a744590079b37d6be32128aafa6#p1352138
—————————————————————
Another method
title: How to get active menu item properties in joomla
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 ;
The above codes maybe works in following structure:
$menu = &JSite::getMenu(); $active = $menu->getActive(); echo $active->name; echo $active->id; echo $active->published;
Source: