Details
-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
4.2011
-
None
-
Operating System:Debian
PHP Version: 5.3.3
Database and version:
Browser (and version): Firefox 6.0.2
Description
When a PathPrefix setting is set in the destination siteaccess , the destinationUrl() function in the ezpLanguageSwitcher class does not remove the PathPrefix from the $urlAlias variable.
I used the following workaround in kernel/private/classes/ezplanguageswitcher.php :
public function destinationUrl()
{
.....
$urlAlias = $destinationElement[0]>getPath( $this>destinationLocale, $siteLanguageList );
// remove pathPrefix from url
$sitePathPrefix = $saIni->variable( 'SiteAccessSettings', 'PathPrefix' );
$urlAliasArray = explode ( '/' , $urlAlias);
if ( in_array($sitePathPrefix,$urlAliasArray) )
{ unset($urlAliasArray[0]); $urlAlias = implode('/',$urlAliasArray); } ......
}
It would be a good idea to have the pathPrefix automatically checked by the languageswitcher in future versions.
Steps to reproduce
- create multiple siteaccess with differents ContentObjectLocale
- specify a PathPrefix in each siteaccess
- translate an object
- use the /switchlanguage/to/$destinationSiteaccess/$node_id function to get the url alias of a node in the destination siteaccess