1

I am in joomla 2.5 and I try to get the id of a menu, I have the name, the alias

exemple :

menu = FAQ-> menu item =FAQ

I have try :

$app         = JFactory::getApplication('site');
$params      = $app->getParams();
$idfaq       = $params->get('content_id_faq');

but i am a newbie so I dont even know if content_id_faq is correct

thanks

Yann
  • 23
  • 3
  • We need to know more about your menu structure to help you. Have a look at here: http://stackoverflow.com/a/3788975/309163 for more information on how to get the correct item. – dhh Jun 09 '15 at 05:21
  • 1
    Thanks, It's not like I want in the first place but it will work so I will use the method 2 – Yann Jun 09 '15 at 08:43
  • Glad that I could help - I have added that as an answer so please mark that one as accepted / upvote if it helped you. – dhh Jun 09 '15 at 09:17

2 Answers2

0

Have a look at here for more information on how to get the correct item.

Community
  • 1
  • 1
dhh
  • 4,289
  • 8
  • 42
  • 59
0

There is no guarantee that either the menu item alias or the article alias must be unique within either the #__menu or #__content table, they just need to be unique within that menu-parent item branch or the category, respectively. Since you are making something custom for a specific site you could modify the queries in the other answer to reflect this; I would do that rather than assuming no one in the future is ever going to use the same aliases. Of course you could write a plugin to basically make those aliases reserved words. Also in your code I would force that to cache so you aren't constantly doing that query.

Elin
  • 6,507
  • 3
  • 25
  • 47