Welcome to the LimeSurvey Community Forum

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

Assigning logo in twig file based on token attribute

  • Bigred01
  • Bigred01's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 9 months ago #170105 by Bigred01
Hey everyone.

I was wondering if anyone has found a non hacky way of setting template visuals like a brand logo based on a token attribute in a twig file.

Previously I would have referenced the sub-domain if it was branded or piped something in from the sample if it was accessible in the pstpl file or even did some js and updated the image based on an attribute, but I am unsure how to approach this in the new templating system.

I am trying to limit how often a template needs to be extended and have common needs like this built into my default template. Ideally I would like the survey admin to have the ability to specify a token attribute that can pipe in an image name.

Any ideas?

I can figure out a work around but more curious if someone has already found a solution.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 9 months ago #170119 by tpartner
You can use this to access token attributes in twig files:

Code:
{{ processString('{strip_tags(TOKEN:ATTRIBUTE_1)}') }}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Bigred01
  • Bigred01's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 9 months ago #170174 by Bigred01
Thanks tpartner. With that I was able to allow them to flag an attribute to be used as an image path/file name else default to what ever was set in the template options if nothing was set.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose