No Country Flags but Text instead

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:


instead of



~~DISCUSSION~~

tips_and_tricks/no_country_flags_but_text.txt · Last modified: 2018/04/05 14:48 (external edit)
Webdesign: NMuD chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0