- Posts: 166
- Thank you received: 26
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Change the logo on the template based on Token Value
- davebostockgmail
- Topic Author
- Offline
- Elite Member
Less
More
4 years 3 months ago #191890
by davebostockgmail
Change the logo on the template based on Token Value was created by davebostockgmail
Just wondering if it is possible to change the image shown as the logo depending on a value in a token attribute
I am working on a project where there are 5 brands from one company and I can identify each brand from the information they have given me.
What I would like to do is something along the lines of ...
if(TOKEN:ATTRIBUTE)=="1","Logo1.png", if(TOKEN:ATTRIBUTE)=="2","Logo2.png ...... etc. etc. etc.
Current Version is : Version 3.20.1+191114
And I am working with the following Theme : LimeSurvey Fruity Theme
If this is not possible in Limesurvey out of the box then any thoughts or ideas would be greatly welcomed.
Thanks
I am working on a project where there are 5 brands from one company and I can identify each brand from the information they have given me.
What I would like to do is something along the lines of ...
if(TOKEN:ATTRIBUTE)=="1","Logo1.png", if(TOKEN:ATTRIBUTE)=="2","Logo2.png ...... etc. etc. etc.
Current Version is : Version 3.20.1+191114
And I am working with the following Theme : LimeSurvey Fruity Theme
If this is not possible in Limesurvey out of the box then any thoughts or ideas would be greatly welcomed.
Thanks
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
4 years 3 months ago - 4 years 3 months ago #191897
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 Change the logo on the template based on Token Value
You can use the processString() function in the theme twig files to access Expression Manager variables and token values.
Code:
"Logo{{ processString("{TOKEN:ATTRIBUTE_1}") }}.png"
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 3 months ago by tpartner.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10634
- Thank you received: 3698
4 years 3 months ago #191898
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 Change the logo on the template based on Token Value
...or, if you need a default value:
Code:
{% set attribute1 = '1' %} {% if processString("{TOKEN:ATTRIBUTE_1}") != '' %} {% set attribute1 = processString("{TOKEN:ATTRIBUTE_1}") %} {% endif %} <img src="pathToImages/Logo{{ attribute1 }}.png" />
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- davebostockgmail
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 166
- Thank you received: 26
4 years 3 months ago #191899
by davebostockgmail
Replied by davebostockgmail on topic Change the logo on the template based on Token Value
Amazing
Thanks Tony
Thanks Tony
The topic has been locked.