Joomla : how to get the url of a specific Menu itemID?

后端 未结 5 1489
夕颜
夕颜 2020-12-16 06:47

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

I am running Joomla and asking for a user to

5条回答
  •  春和景丽
    2020-12-16 07:23

    However, we get the Itemid from anywhere (user input, from our own developed module using the "menu item" field type in the xml file as described in the Joomla Docs - Standard form field types)

    // get the menuItemId from wherever...
    // as described above or as in other posts here and do whatever with that!
    $menuItemId = 'fromWherever'; // as an example "107";
    
    // build the link to the menuItemId is just easy and simple
    $url = JRoute::_('index.php?Itemid=' . $menuItemId);
    

    i think if we need only a link to a specific menu id, this is the best solution, because we have absolutely less requests and a clean code

    this works also in Joomla 3.0, 3.1

提交回复
热议问题