Sebastian Opperman
Sebastian Opperman

Reputation: 241

Joomla Menuitem SEF url

I am building a module in Joomla. I am using the Module Parameter (Menuitem). It returns the menu id to the default.php file in the module.

I then build a URL with the following code:

$itemID = $params->get( 'url' ); // Menuitem id
$application = JFactory::getApplication();
$menu = $application->getMenu();
$item = $menu->getItem( $itemID );
$link = new JURI($item->link);
$link->setVar( 'ItemId', $itemid );
$articleLink = $link;

It works correctly but the link is not a SEF url:

It is:

index.php/component/content/article?id=25

instead of:

index.php/call-back-request

How would i convert the url to a SEF url? any help would be appeciated

Upvotes: 1

Views: 1580

Answers (1)

Irfan
Irfan

Reputation: 7059

You can create sef url using JRoute. This may help you-

$link=JRoute::_($link);

for more details read this- http://docs.joomla.org/Search_Engine_Friendly_URLs

Update:

//article sef
$catslug = $row->catid.':'.$row->category_alias;
$slug = $row->id.':'.$row->alias;
$link = JRoute::_(ContentHelperRoute::getArticleRoute($slug, $catslug));

Upvotes: 2

Related Questions