Hello,
I’m using the following snippet to select the language:
<?php
// get languages info
$tv = $modx->getTemplateVar('languages', "", $modx->documentIdentifier);
$languages = $tv['value'];
if (!strlen($languages))
{
return "";
}
$langnames = array(
"en" => "English",
"de" => "Deutsch",
"fr" => "Français",
"it" => "Italiano"
);
$output = "";
// get entries in languages list
$entries = explode(",", $languages);
// loop through language entries
for ($e = 0; $e < count($entries); $e++)
{
// seperate into lang code and target document id
list($lang, $targetid) = explode("=", $entries[$e]);
$image = '<img src="assets/images/'.$lang.'.gif" width="16" height="11" border="0" alt="'.$langnames[$lang].'" />';
if (strlen($output))
{
$output .= ' ';
}
//$output .= '<a href="'.$modx->makeUrl($targetid).'">'.$image.'</a>';
$output .= '<li><a href="'.$modx->makeUrl($targetid).'" title="'.$langnames[$lang].'"><span>'.strtoupper($lang).'</span></a></li>';
}
return $output;
?>
the snippet does not list the currently selected language - how could I list also the current language in the shown language list?
thank you in advance for your help