Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Concatenate twig functions

More
4 years 6 months ago #211825 by AritzP
Hi everyone!

We are trying to put a different logo on the nav-bar depending of the user's logo attribute. So we have created an attribute which reads the name of the logo.

On the theme's editor, we can take that value with 'processString("{TOKEN:ATTRIBUTE_1}")'.

The problem is that I am trying to insert that code on {{ image('./files/processString("{TOKEN:ATTRIBUTE_1}").png', 'Logo', {"class": "logo img-responsive"}) }} but it doesn´t work. I have tried this way too: {{ image('./files/', processString("{TOKEN:ATTRIBUTE_1}"), '.png', 'Logo', {"class": "logo img-responsive"}) }}

Is there any way to use the attribute value on {{ image }} function?

I am using 3.17 version of Limesurvey

Thanks for your time!
The topic has been locked.
More
4 years 6 months ago #211827 by DenisChenu
Code:
{% set imageFile = './files/' ~ processString("{TOKEN:ATTRIBUTE_1}")~ '.png' %}
{{ image(imageFile, 'Logo', {"class": "logo img-responsive"}) }}
maybe

See
twig.symfony.com/doc/2.x/templates.html#twig-expressions
twig.symfony.com/doc/2.x/tags/set.html

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The following user(s) said Thank You: AritzP
The topic has been locked.
More
4 years 6 months ago #211843 by AritzP
Replied by AritzP on topic Concatenate twig functions
It works like a charm, thanks Denis!!
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose