How can i check if an item is part of a specific menu [Joomla 3.3]

Dustin

i already know how to parse id/name and stuff from my current/active menu-item, but i want to know if it's part of a specific menu for example:

I have this Menu with the name "mainmenu" and type "mainmenu": Home | About | Contact | Testing

If i click on About i want to know if About is part of "mainmenu" - how can i do that?

like this:

$app = JFactory::getApplication();
$menu = $app->getMenu();
$activeitem = $menu->getActive()->id;
// And now the if-statement - which asks if activeitem is part of "mainmenu" and if yes do that, and if not do that...

I hope you know what i mean...

Thanks for any help

Irfan

You can check menutype using below code -

$app = JFactory::getApplication();
$menu = $app->getMenu();
$menutype = $menu->getActive()->menutype;
if($menutype =='mainmenu'){//check if active menu part of 'mainmenu'

}

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Joomla 3.x: How to allow underscore in menu item aliases

분류에서Dev

How can I change the color of the selected item in a menu?

분류에서Dev

How can I check if .dll are part of the .net 2.0 Framework?

분류에서Dev

RAILS 3: How can I reload a partial?

분류에서Dev

How can I set 3 values in spinner

분류에서Dev

JQuery not working on Joomla 3

분류에서Dev

how can i add and list a item to cart when checked a check box?

분류에서Dev

How can I check if a line contains specific string from a list of strings?

분류에서Dev

How can I pass menu below?Bootstrap

분류에서Dev

How can I hold the menu open in the JComboBox?

분류에서Dev

How can I get pygame for Python3?

분류에서Dev

How can I simplify my "equation" to switch between 3 and 5?

분류에서Dev

How can I stop printing a float 3 spaces after decimal?

분류에서Dev

How can I create 3 columns using UICollectionView

분류에서Dev

How can I show the date in the gnome 3 menubar?

분류에서Dev

Can not click on menu unless it has menu item

분류에서Dev

How do I get a specific part from this JSON response?

분류에서Dev

How do I get a specific part from this JSON response?

분류에서Dev

Joomla 3.x의 mod_menu에서 helper.php의 코드 블록 이해

분류에서Dev

How Joomla implement the item publishing and item unpublishing function?

분류에서Dev

How can I check for an @ in a regular expression?

분류에서Dev

How can I check if a gzipped file is empty?

분류에서Dev

How can I check in Apex if a batch is scheduled?

분류에서Dev

How i can check internet connection? android

분류에서Dev

I want to float 3rd child menu to left

분류에서Dev

Is it possible to insert a menu item at a specific position in Dijit using Dijit/Menu

분류에서Dev

How can I set Crontab for a specific hour?

분류에서Dev

How can I connect to a specific BSSID?

분류에서Dev

How can I block a specific host

Related 관련 기사

  1. 1

    Joomla 3.x: How to allow underscore in menu item aliases

  2. 2

    How can I change the color of the selected item in a menu?

  3. 3

    How can I check if .dll are part of the .net 2.0 Framework?

  4. 4

    RAILS 3: How can I reload a partial?

  5. 5

    How can I set 3 values in spinner

  6. 6

    JQuery not working on Joomla 3

  7. 7

    how can i add and list a item to cart when checked a check box?

  8. 8

    How can I check if a line contains specific string from a list of strings?

  9. 9

    How can I pass menu below?Bootstrap

  10. 10

    How can I hold the menu open in the JComboBox?

  11. 11

    How can I get pygame for Python3?

  12. 12

    How can I simplify my "equation" to switch between 3 and 5?

  13. 13

    How can I stop printing a float 3 spaces after decimal?

  14. 14

    How can I create 3 columns using UICollectionView

  15. 15

    How can I show the date in the gnome 3 menubar?

  16. 16

    Can not click on menu unless it has menu item

  17. 17

    How do I get a specific part from this JSON response?

  18. 18

    How do I get a specific part from this JSON response?

  19. 19

    Joomla 3.x의 mod_menu에서 helper.php의 코드 블록 이해

  20. 20

    How Joomla implement the item publishing and item unpublishing function?

  21. 21

    How can I check for an @ in a regular expression?

  22. 22

    How can I check if a gzipped file is empty?

  23. 23

    How can I check in Apex if a batch is scheduled?

  24. 24

    How i can check internet connection? android

  25. 25

    I want to float 3rd child menu to left

  26. 26

    Is it possible to insert a menu item at a specific position in Dijit using Dijit/Menu

  27. 27

    How can I set Crontab for a specific hour?

  28. 28

    How can I connect to a specific BSSID?

  29. 29

    How can I block a specific host

뜨겁다태그

보관