Posted By

kevincam on 05/24/12


Tagged

menu find joomla itemid sef


Versions (?)

How to get menu Itemid in your own components


 / Published in: PHP
 

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

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

Report this snippet  

You need to login to post a comment.