248 Posts
Giuse
5 years ago
Topic

Hi, to build a SEF URL to a Seblod article in php, we have to use

plgCCK_Storage_LocationJoomla_Article::getRoute($_article_id, $sef, $menu_id);

This works but in current language. If you want to build the SEF URL on another language (available on your multilanguage site), that call does not build a correct URL, in particulare it does not set the language code string after base URI. For example if current language is English with removal of default language "en" in the URL so current URL is like "<host>/<menu_alias_EN>/<article_id_EN>-<article_alias_EN>" and you want to retrieve the URL of a Seblod article in French, the Seblod router will return "<host>/<menu_alias_FR>/<article_id_FR>-<article_alias_FR>" that is wrong since it should be "<host>/FR/<menu_alias_FR>/<article_id_FR>-<article_alias_FR>".

How to get a proper URL without having to manipulate the result? Changing temporary current language via PHP, how? Or passing the language code to the getRoute function, how?

Thanks a lot

Giuse

Get a Book for SEBLOD
4229 Posts
Kadministrator
5 years ago
1
Level 1

Method definition has changed in the latest versions...:

public static function getRoute( $item, $sef, $itemId, $config = array(), $lang = '' )
248 Posts
Giuse
5 years ago
0
Level 2

Thanks Klas, this tutorial should be updated

https://www.seblod.com/resources/tutorials/how-to-generate-seblod-sef-url

Get a Book for SEBLOD