Martin
Martin

Reputation: 10563

Make Joomla component compatible with SEF/SEO

Hi I have developed a custom component for Joomla 1.5. However the urls when SEF is turned on could look a bit better e.g. display the title rather than the id, how can I make custom urls for my component when SEF for Joomla is turned on?

Upvotes: 2

Views: 3168

Answers (2)

Moamen Mostafa
Moamen Mostafa

Reputation: 359

You Can use JRoute class as follows:

JRoute::_( $url, $xhtml = true, $ssl=null );

$url is a string containing the absolute or relative internal Joomla! URL.

$xhtml is a boolean value that specifies whether or not the output should be in XHTML. This parameter is optional and if omitted defaults to true.

$ssl is an integer value that specifies whether the URI should be secure. It should be set to 1 to force the URI to be secure using the global secure site URI, 0 to leave it in the same state as when it was passed, and -1 to force the URI to be unsecure using the global unsecure site URI.

The most important parameter is $url. A call to this method might look like:

JRoute::_( 'index.php?view=article&id='.$[itemID] );

Upvotes: 1

Jeepstone
Jeepstone

Reputation: 2601

Have you looked in to the Joomla routing methods? http://docs.joomla.org/Routing

Upvotes: 2

Related Questions