Joomla 3.1-获取活动菜单项网址 [英] Joomla 3.1 - Get active menu item url

查看:95
本文介绍了Joomla 3.1-获取活动菜单项网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦我点击主菜单中的媒体"项,就会生成以下网址:

As soon as I click on the "Media" item in my main menu, the following url is generated:

http://test.local/index.php/media-files

现在,我想创建一个仅在媒体文件中显示的模块.而且,我想检索此活动菜单项的URL.

Now, I would like to create a module that is displayed only in media-files. Moreover, I want to retrieve the url of this active menu item.

所以我的问题是:如何获得活动菜单项的SEF-URL?

So my question: How can I get the SEF-URL of an active menu item?

预先感谢

enne

推荐答案

我认为这可能是您想要的:

I think this might be what you want:

$app  = JFactory::getApplication();
$menu = $app->getMenu()->getActive()->link;

echo JRoute::_($menu);

我也对此进行了测试,所以请告诉我它是否是您所需要的.

I've tested this as well, so let me know if it's what you require.

这篇关于Joomla 3.1-获取活动菜单项网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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