In a multi-language installation CMSimple offers coloured country flags to switch betweeen languages. Often these flags hurt your eyes and you want text instead. Ok, let’s do it:
Open /cmsimple/function.php and add the following function:
function textlanguagemenu() { global $pth, $cf, $sl; $t = ''; $r = array (); $fd = @ opendir($pth['folder']['base']); while (($p = @ readdir($fd)) == true) { if (@ is_dir($pth['folder']['base'].$p)) { if (preg_match('/^[A-z]{2}$/', $p)) $r[] = $p; } } if ($fd == true) closedir($fd); if (count($r) == 0) return ''; if ($cf['language']['default'] != $sl) $t .= '<a href="'.$pth['folder']['base'].'">['.$cf['language']['default'].']</a> '; $v = count($r); for ($i = 0; $i < $v; $i ++) { if ($sl != $r[$i]) { $t .= '<a href="'.$pth['folder']['base'].$r[$i].'/">['.$r[$i].']</a> '; } } return ''.$t.''; }
In your template use now:
<?php echo textlanguagemenu();?>
instead of
<?php echo languagemenu();?>
Good luck
Acknowledgement: This code has initially been developed by djot
Example:
Discussion