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

问题描述

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

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

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

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?

提前致谢,

恩恩

推荐答案

我想这可能是你想要的:

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 - 获取活动菜单项 url的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 08:54