Adding sh404SEF compatibility to you Joomla component

The sh404SEF extention is a popular solution to manage SEF URLs in Joomla Web sites. It is relatevely easy to add sh404SEF compatibility to your component.

You need first to create a "sef_ext" subfolder under your root component folder. Than you will create a file with the same name of the component, like
/components/com_mycomponent/sef_ext/com_mycomponent.php   

The code template for a new com_mycomponent.php file is the following:

<?PHP
// -- standard plugin initialize function - don't change --------------
global $sh_LANG, $sefConfig;
$shLangName = '';;
$shLangIso = '';
$title = array();
$shItemidString = '';
$dosef = shInitializePlugin( $lang, $shLangName, $shLangIso, $option);
// -- standard plugin initialize function - don't change -------------- 
 
// your code
$title[] = 'products';
$title[] = 'myproduct';
// your code 
 
// -- standard plugin finalize function - don't change ----------------
if ($dosef){
   $string = shFinalizePlugin( $string, $title, $shAppendString, $shItemidString,
      (isset($limit) ? @$limit : null), (isset($limitstart) ? @$limitstart : null),
      (isset($shLangName) ? @$shLangName : null));
}
// -- standard plugin finalize function - don't change ---------------- 
?>

Your task is to fill the $title array with the elements of your choice. The example above will produce the following SEF URL:

http://www.mysite.com/products/myproduct

Now you can use request parameters and database queries to build a right URL path for your component.

References

  1. How do I write a sh404SEF plugin for my component?
Last Updated on Friday, 05 March 2010 20:43