0

I am using joomla 2.5 + Falang, how to get current language flag?

I tried:

<?php foreach($list as $language):?>
 <?php echo JHtml::_('image', 'mod_falang/'.$language->image.'.gif', $language->title_native, array('title'=>$language->title_native), true);?>

but then I get all available language flags.

Grufas
  • 1,350
  • 4
  • 21
  • 33

1 Answers1

1

Try this

$lang =& JFactory::getLanguage();
$CurrentFlag = "";
foreach($list as $language){
       if($language->lang_code == $lang->getTag()){
            $CurrentFlag = $language->image.'.gif';
        }

 }
echo JHtml::_('image', 'mod_falang/'.$CurrentFlag, $lang->getName(), array('title'=>$lang->getName()), true);

Hope its helps..

Jobin
  • 8,238
  • 1
  • 33
  • 52
  • Thanx, but it is not working, i only get a list of ini language files. I red that topic and used code to get current language name, but there is no info about how to get language flag :( – Grufas Mar 01 '13 at 06:27
  • @LifeIsShort Hope you get it – Jobin Mar 01 '13 at 07:19
  • There is no need to return by reference anymore, it will generate plenty of warnings. Instead of `$lang =& JFactory::getLanguage();` should be `$lang = JFactory::getLanguage();` – Marko D Mar 01 '13 at 08:50