- Posts: 2
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Different Logo for Different Language
- benjaminschlegel
- Topic Author
- Offline
- New Member
Less
More
6 years 2 months ago - 6 years 2 months ago #163957
by benjaminschlegel
Different Logo for Different Language was created by benjaminschlegel
I am trying to expend the theme fruity. My goal is to display a different logo depending on the chosen language. I am updating the custom nav_bar.twig. I tried the following code, where I also tried {{ SURVEYLANG }}, { SURVEYLANG }, in small letters, with surveylanguage Capital and small letters and LANG in call variations.
Does anyone know how I can do this?
Edit: I'm using Limesurvery 3.0.0.
Code:
{# Logo option #} {% if( aSurveyInfo.options.brandlogo == "on") %} <div class="{{ aSurveyInfo.class.navbarbrand }} logo-container hidden-xs" {{ aSurveyInfo.attr.navbarbrand }} > {% if( SURVEYLANG == "fr") %} {{ image( "./files/logo_fr_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% else %} {{ image( "./files/logo_de_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% endif %} </div> {% else %} <div class="{{ aSurveyInfo.class.navbarbrand }}" {{ aSurveyInfo.attr.navbarbrand }} > {{ aSurveyInfo.name }} </div> {% endif %}
Does anyone know how I can do this?
Edit: I'm using Limesurvery 3.0.0.
Last edit: 6 years 2 months ago by benjaminschlegel.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10098
- Thank you received: 3589
6 years 2 months ago #163966
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Different Logo for Different Language
Try this for your IF statement:
Code:
{% if( aSurveyInfo.surveyls_language == "fr") %} {{ image( "./files/logo_fr_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% else %} {{ image( "./files/logo_de_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% endif %}
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: benjaminschlegel
The topic has been locked.
- benjaminschlegel
- Topic Author
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
6 years 2 months ago - 6 years 2 months ago #163968
by benjaminschlegel
Replied by benjaminschlegel on topic Different Logo for Different Language
Thanks a lot, that worked!
Last edit: 6 years 2 months ago by benjaminschlegel.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10098
- Thank you received: 3589
6 years 2 months ago #163978
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Different Logo for Different Language
For reference...in most template Twig files, you can see all available variables in the aSurveyInfo array by setting debug to 1 and placing this somewhere in the Twig file:
Code:
{{ dump(aSurveyInfo) }}
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- tschaipi
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
4 years 5 months ago #190192
by tschaipi
Replied by tschaipi on topic Different Logo for Different Language
And why doesn't the 3 language option work? I can't find the typo ...
[/code]
Code:
{% if( aSurveyInfo.surveyls_language == "fr") %} {{ image( "./files/logo_fr_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% else if( aSurveyInfo.surveyls_language == "it") %} {{ image( "./files/logo_it_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% else %} {{ image( "./files/logo_de_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% endif %}
Code:
[code]
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
4 years 5 months ago #190193
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Different Logo for Different Language
I don't think you have else if in twig :
twig.symfony.com/doc/2.x/tags/if.html
Then :
or
Alternative :
I like this one
twig.symfony.com/doc/2.x/tags/if.html
Then :
Code:
{% if( aSurveyInfo.surveyls_language == "fr") %} {{ image( "./files/logo_fr_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% if( aSurveyInfo.surveyls_language == "it") %} {{ image( "./files/logo_it_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% if( aSurveyInfo.surveyls_language == "de") %} {{ image( "./files/logo_de_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% endif %}
or
Code:
{% if( aSurveyInfo.surveyls_language == "fr") %} {{ image( "./files/logo_fr_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% if( aSurveyInfo.surveyls_language == "it") %} {{ image( "./files/logo_it_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% if( aSurveyInfo.surveyls_language != "fr" and aSurveyInfo.surveyls_language != "it") %} {{ image( "./files/logo_de_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% endif %}
Alternative :
Code:
{{ image( "./files/logo_" ~ aSurveyInfo.surveyls_language ~ "_quer.png", 'anytext', {"class": "logo img-responsive"}) }}
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10098
- Thank you received: 3589
4 years 5 months ago #190206
by tpartner
But, yes, I like the last one too! It's more elegant.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Different Logo for Different Language
I see elseif:I don't think you have else if in twig :
twig.symfony.com/doc/2.x/tags/if.html
But, yes, I like the last one too! It's more elegant.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- tschaipi
- Offline
- New Member
Less
More
- Posts: 2
- Thank you received: 0
4 years 5 months ago #190219
by tschaipi
Replied by tschaipi on topic Different Logo for Different Language
Well I still get a 500: internal server error (Unexpected end of template) with this code:
Any ideas?
Code:
{# Logo language option #} {% if( aSurveyInfo.surveyls_language == "de") %} <div class="{{ aSurveyInfo.class.navbarbrand }} logo-container hidden-xs" {{ aSurveyInfo.attr.navbarbrand }} > {{ image( "./files/WBF_SBFI_D_RGB_pos_hoch.png", 'Logo', {"class": "logo img-responsive"}) }} </div> {% if( aSurveyInfo.surveyls_language == "fr") %} <div class="{{ aSurveyInfo.class.navbarbrand }} logo-container hidden-xs" {{ aSurveyInfo.attr.navbarbrand }} > {{ image( "./files/WBF_SBFI_F_RGB_pos_hoch.png", 'Logo', {"class": "logo img-responsive"}) }} </div> {% if( aSurveyInfo.surveyls_language == "it") %} <div class="{{ aSurveyInfo.class.navbarbrand }} logo-container hidden-xs" {{ aSurveyInfo.attr.navbarbrand }} > {{ image( "./files/WBF_SBFI_I_RGB_pos_hoch.png", 'Logo', {"class": "logo img-responsive"}) }} </div> {% endif %}
Any ideas?
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
4 years 5 months ago - 4 years 5 months ago #190221
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Different Logo for Different Language
Need more endif
Else , seems elseif is OK, and NOT else if (thanks @tpartner)
Code:
{% if( aSurveyInfo.surveyls_language == "de") %} <div class="{{ aSurveyInfo.class.navbarbrand }} logo-container hidden-xs" {{ aSurveyInfo.attr.navbarbrand }} > {{ image( "./files/WBF_SBFI_D_RGB_pos_hoch.png", 'Logo', {"class": "logo img-responsive"}) }} </div> {% endif %} {% if( aSurveyInfo.surveyls_language == "fr") %} <div class="{{ aSurveyInfo.class.navbarbrand }} logo-container hidden-xs" {{ aSurveyInfo.attr.navbarbrand }} > {{ image( "./files/WBF_SBFI_F_RGB_pos_hoch.png", 'Logo', {"class": "logo img-responsive"}) }} </div> {% endif %} {% if( aSurveyInfo.surveyls_language == "it") %} <div class="{{ aSurveyInfo.class.navbarbrand }} logo-container hidden-xs" {{ aSurveyInfo.attr.navbarbrand }} > {{ image( "./files/WBF_SBFI_I_RGB_pos_hoch.png", 'Logo', {"class": "logo img-responsive"}) }} </div> {% endif %}
Else , seems elseif is OK, and NOT else if (thanks @tpartner)
Code:
{% if( aSurveyInfo.surveyls_language == "fr") %} {{ image( "./files/logo_fr_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% elseif( aSurveyInfo.surveyls_language == "it") %} {{ image( "./files/logo_it_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% else %} {{ image( "./files/logo_de_quer.png", 'anytext', {"class": "logo img-responsive"}) }} {% endif %}
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 4 years 5 months ago by DenisChenu.
The following user(s) said Thank You: tschaipi
The topic has been locked.