Joomla:如何获取特定菜单itemID的网址? [英] Joomla : how to get the url of a specific Menu itemID?

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

问题描述

朋友一个新手问题......我需要帮助来获取特定菜单itemID的URL.情况是这样的:

Friends a newbie question.........I need help in getting the URL of a specific Menu itemID. The situation is like this:

我正在运行Joomla,并要求用户输入菜单ID,然后选择该菜单ID的布局.

I am running Joomla and asking for a user to input for a menu ID and choose a layout for that menu ID.

我想使用菜单itemID的此URL做其他事情.

I want to do something else with this URL of the Menu itemID.

如何获取用户提供的此菜单itemID的URL?

How can I get the URL of this Menu itemID provided by the user?

例如,如果用户输入为liek $this->get ('menulayoutid'>;,而他输入的ID为54,那么我如何获得菜单ID 54的URL.

For Example if the user input is liek $this->get ('menulayoutid'>; and he inputs and ID of 54 then how do I get the URL for Menu ID 54.

请注意::我想从我的PHP文件而不是浏览器中获取此URL,以便可以将该URL的值用于其他目的.

Please note: I want to get this URL from within my PHP file and not in the browser so that I can use the value of that URL for some other purpose.

请帮助.

推荐答案

$itemid = JRequest::getVar('Itemid');
$application = JFactory::getApplication();
$menu = $application->getMenu();
$item = $menu->getItem($itemid);
$link = new JURI($item->link);
$link->setVar('ItemId', $itemid);

来源: http://forum.joomla.org/viewtopic.php?p= 1836005

这篇关于Joomla:如何获取特定菜单itemID的网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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