Return to Snippet

Revision: 57282
at May 24, 2012 03:37 by kevincam


Updated Code
$url = 'index.php?option=[[option]]&view=[[view]]';
$menu = &JSite::getMenu();
$menuItem = $menu->getItems( 'link', $url, true );
$Itemid = $menuItem->id;

Revision: 57281
at May 24, 2012 03:29 by kevincam


Initial Code
$url = 'index.php?option=[[option]]&view=[[view]]';
$menu = &JSite::getMenu();
$menuItem = $menu->getItems( 'link', $url, true );
$Itemid = $menuItem->id;

Initial URL

                                

Initial Description
Joomla SEF to work properly it is based on Joomla menus. In your own components for SEF to work and menus to appear your need to pass the Itemid to links. To do this you need to get the Itemid based on on the URL link. Here is how you get the Itemid by link.

This code gets the Itemid of a menu link when you know the component and the view

Initial Title
How to get menu Itemid in your own components

Initial Tags
find, joomla

Initial Language
PHP