I realized that there is already a function implemented for sef in sobi2.
It is th "sef" function in config.class.php in sobi2 :
function sef ( $url )
{
$config = & sobi2Config::getInstance();
if ( $config->key( 'general', 'extended_menu', true ) && class_exists( 'JURI' ) ) {
$url = $config->itemid( $url );
}
if ( $config->key( 'frontpage', 'sef_on', true ) ) {
if ( class_exists( 'JURI' ) ) {
$url = str_replace( '&', '&', $url );
$uri = JURI::getInstance();
$prefix = $uri->toString( array( 'scheme' , 'host' , 'port' ) );
$JURL = $prefix . JRoute::_( $url );
return $JURL;
}
else {
return sefRelToAbs( $url );
}
}
else {
return $config->liveSite . '/' . $url;
}
}
you need to call this function as follows :
inside sobi2 :
$href=$config->sef($href);
outside sobi2 :
$href=$config->sef($href);
There is no need to implement a new functionality.