Elxis CMS Forum

Support => General => Topic started by: openita on February 17, 2014, 18:10:48

Title: Company logo
Post by: openita on February 17, 2014, 18:10:48
Hello!
Can you please tell me where I have to go to change the code that allows me to use a company logo differently depending on the language selected?
Thank you!  ;)
Title: Re: Company logo
Post by: datahell on February 17, 2014, 18:35:37
I don't know which is the "logo" you are taking about but I guess in your template. In this case the answer is obvious: In your template's index.php file.

The current language in Elxis 4.x can be retrieved like this:

$eLang = eFactory::getLang();
$lang = $eLang->currentLang(); //$lang = en, el, it, de, es, ru, etc....
Title: Re: Company logo
Post by: openita on February 17, 2014, 18:43:23
The logo appears here,
$this->tplparams['logo'] = trim($params->get('logo', 'templates/delta/images/logo.png'));

I wish that this will change according to the change of the language.
Title: Re: Company logo
Post by: datahell on February 17, 2014, 19:00:51
OK, so we talk about template Delta. Follow my instructions.
Open this file: templates/delta/includes/delta.class.php
Go to line 56
$this->tplparams['logo'] = trim($params->get('logo', 'templates/delta/images/logo.png'));
Write below:
$lng = eFactory::getLang()->currentLang();
switch ($lng) {
        case 'it': $this->tplparams['logo'] = 'templates/delta/images/logo_it.png'; break;
        case 'de': $this->tplparams['logo'] = 'templates/delta/images/logo_de.png'; break;
        case 'fr': $this->tplparams['logo'] = 'templates/delta/images/logo_fr.png'; break;
        case 'ru': $this->tplparams['logo'] = 'templates/delta/images/logo_ru.png'; break;
        default: break;
}

The languages I wrote are sample ones. You should write the ones you actually use. Note that you dont have to write a case for the default language, only for the secondary ones. Name your language related images as show above and place them into the "images" folder of template Delta.
Title: Re: Company logo
Post by: openita on February 17, 2014, 19:41:17
thank you very much  ;D