Elxis CMS Forum

Support => General => Topic started by: pachinko on June 27, 2007, 16:54:52

Title: select language by flag, not by inputbox
Post by: pachinko on June 27, 2007, 16:54:52
Hi everybody!
I am new to Elxis and hope it is just as intuitive and flexible as it looks!  :D My congratulations to the developers!

Until now, I haven't encountered any real problems, and therefore just have one question: As I have been using Joomla for a while now, I have gotten used to presenting users language flags instead of inputboxes for their choice of language. This of course is no major obstacle for using Elxis, but actually it doesn't look so good on my site. Might there be any chance to get rid of it (As you might have noticed, I am no php expert ;D) ? Mod_language looks so short and simple, there must be a way to make that change...!
Hoping for help, pachinko
Title: Re: select language by flag, not by inputbox
Post by: eliasan on June 27, 2007, 17:57:44
Hi and welcome,

You could replace mod_language.php code with something like that.
Please, ALWAYS KEEP A BACKUP OF THE ORIGINAL FILE.

Code: [Select]
<?php 
/**
* @ Version: $Id$
* @ Copyright: Copyright (C) 2006 GoUp Inc. All rights reserved.
* @ Package: Elxis
* @ Subpackage: Module Language
* @ License: http://www.gnu.org/copyleft/gpl.html GNU/GPL
* Elxis CMS is a Free Software
*/

defined( &#39;_VALID_MOS&#39; ) or die( &#39;Direct Access to this location is not allowed.&#39; );


$moduleclass_sfx  $params->get( &#39;moduleclass_sfx&#39; );
$lng_indicator  intval($params->get( &#39;indicator&#39; ));
$lng_flag  intval($params->get( &#39;flag&#39; ));

 
global $mosConfig_pub_langs$lang;
  switch (
$lng_indicator) {
      case &
#39;1&#39;:
          
echo _E_LANGUAGE.&#39;: <br>&#39;;
      
break;
      case &
#39;2&#39;:
      
break;
      case &
#39;0&#39;:
      
default:
          echo 
_E_LANGUAGE.&#39;: &#39;;
      
break;
  }

  
$frLangs explode(&#39;,&#39;, $mosConfig_pub_langs);    
  
foreach ($frLangs as $langx) {
    if (
file_exists($mosConfig_absolute_path.&#39;/language/&#39;.$langx.&#39;/&#39;.$langx.&#39;.gif&#39;)) {                        
        
echo "<a href=\"index.php?mylang="$langx ."\">";
        echo 
"<img src=\"".$mosConfig_live_site."/language/".$langx."/".$langx.".gif\" border=\"". ($langx===$lang?1:0) ."\" style=\"vertical-align:middle\">";
        echo 
"</a> ";
    }
  }
?>

It will give you all available languages, as flags in a row, plus you can select if the "Language" label will be visible or not.

This is a very simple modification, but it will do the job.
Title: Re: select language by flag, not by inputbox
Post by: pachinko on June 27, 2007, 18:08:06
Juhuhu! You have really made my day, eliasan!  :D
That was quick, that was straight, that was just plain awesome!! Got it up and running and looking good, thank you very much!
Greets, pachinko

.........................................
ELXIS fan from today...! ;)
Title: Re: select language by flag, not by inputbox
Post by: eliasan on June 27, 2007, 22:27:32
You are welcome!