Joomla 3 get the menu title

给你一囗甜甜゛ 提交于 2019-12-06 11:20:54
Lahmizzar

Also you can use this one:

$menu = &Jsite::getMenu();
$menuname = $menu->getActive()->title;

or if already $app = JFactory::getApplication(); exist

$menu = $app->getMenu();
$menuname = $menu->getActive()->title;
Lakshmi Bade

The below code works for me in Joomla 3.0:

$app = JFactory::getApplication();

$menu = $app->getMenu();
$menuname = $menu->getActive()->title;

Use this:

/** Getting the Menu ID of Menu was clicked by user **/
$menu    =   &JSite::getMenu(); 
$id    =   $menu->getActive()->id;

/** Getting the Title of the Menu by using id. **/ 
$db    = JFactory::getDBO();
$query    = "SELECT title FROM kjs_menu WHERE id = $id";
$db->setQuery($query);
$rows    = $db->loadObjectList();
$itemrow = $rows[0];
$title   =   $itemrow->title;

echo "Menu you have clicked is : ".$title;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!