Joomla 3获得菜单标题 [英] Joomla 3 get the menu title

查看:50
本文介绍了Joomla 3获得菜单标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一页上使用多个菜单. 在多个div中,我显示了一个菜单(菜单1至菜单6).出于模板目的,我希望将每个菜单的菜单标题显示在顶部. 我没有从菜单中获取标题.

I'm using multiple menus on one page. In multiple divs I'm showing a menu (menu1 to menu6). For templating purposes I would like to get the menu title of each menu to show on top. I'm not managing to get the title from the menu.

我发现这是获取菜单项的方法.

I found this is the way to get the menu items.

<?php
$menu = $app->getMenu();
$menu_items = $menu->getItems('menutype', 'menu1');
var_dump ($menu_items);
?>

没那么难,但是找不到正确的语法.谁能帮助我?

Couldn't be so hard but can't find the right syntax. Who could help me?

预先感谢

Wims

推荐答案

您也可以使用以下方法:

Also you can use this one:

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

或者如果已经存在$app = JFactory::getApplication();

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

这篇关于Joomla 3获得菜单标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆