Changes
Title
unchanged
SEO-conform Multilingual URLs + Language Selector Widget (i18n)
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
multilanguage, language, seo, i18n, widget
Content
changed
[...]
if(sizeof($languages) < 4) {
// Render options as links
$lastElement = end($languages);
foreach($languages as $key=>$lang) {
if($key != $currentLang) {
echo CHtml::link($lang,
$lang,
$this->getOwner()->createMultilanguageReturnUrl($key));
} else echo '<b>'.$lang.'</b>';
if($lang != $lastElement) echo ' | ';[...]
else {
// Render options as dropDownList
// Use: CHtml::form($action='', $method='post', $htmlOption=array())
echo CHtml::form();
// for each language, add a hidden field with the MultilanguageReturnUrl for that language. echo CHtml::form();
foreach($languages as $key=>$lang) {
echo CHtml::hiddenField(
$key,
$key,
$this->getOwner()->createMultilanguageReturnUrl($key));
}
echo CHtml::dropDownList('language', $currentLang, $languages,
array(
'submit'=>'',
)[...]