Welcome to the LimeSurvey Community Forum

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

Customizing twig template

  • apires
  • apires's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 9 months ago #180334 by apires
Customizing twig template was created by apires
Hi,

I'm migrating the LimeSurvey from our company (v2.0.0) to a lastest one (3.15.6),
I already have everything working in the new one, but, having some issues.

So, in the oldest version, we got a few customizing fields and flows, for example, at the begining of survey, we have an pop-up asking for the user wanna asnwer for the group of companies, or a individual one.

My issues is about passing variables to the html (welcome.twig) page. I'm newbie in php, more newbie with twig development. In the oldest version (startpage.pstpl), we pass variables from replacements_helper.php (templace_replace) to the screen using {variable}, and in the newest one, is something like {{name}}.

I've looking in the projects, and all the variables is passed by "i.e aSurveyInfo.class.something", it should be the same?

I've tried almost everything, and cant pass variable values from replacements_helper to the page.. any idea?

Best regards
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 9 months ago #180336 by LouisGac
Replied by LouisGac on topic Customizing twig template
The topic has been locked.
  • apires
  • apires's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 9 months ago - 5 years 9 months ago #180337 by apires
Replied by apires on topic Customizing twig template
Thanks for the information.

I've readed this topic before, and still stuked with this problem in my head.
Its not suposed to pass variables from replacements_helper.php file to the view? welcome.twig for example? when the page loads, i can echo all the variables to Chrome console, but cant display in welcome.twig page... i'm trying with {{ variable }} and its not working.
Attachments:
Last edit: 5 years 9 months ago by apires.
The topic has been locked.
  • apires
  • apires's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 9 months ago #180338 by apires
Replied by apires on topic Customizing twig template
I've tryied with 1 and 2 bracelets {{ }} and nothing.. :(
The topic has been locked.
More
5 years 9 months ago #180339 by jelo
Replied by jelo on topic Customizing twig template

apires wrote: I've tryied with 1 and 2 bracelets {{ }} and nothing.. :(

It's still very messy. Not every twig template is correctly getting every variable.

To display variables like in LS2, you should try processString.
Code:
{{ processString("{VARNAME}") }}

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • apires
  • apires's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 9 months ago #180350 by apires
Replied by apires on topic Customizing twig template
God bless you!! It works now :))

Many thanks

Cheers
The topic has been locked.
More
5 years 9 months ago #180353 by jelo
Replied by jelo on topic Customizing twig template

apires wrote: God bless you!! It works now :))

You can thank Denis for forcing to implement this. It's always good to have developers with first hand experience on actual running a survey. You cannot take that for grated here ;-)

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • LouisGac
  • LouisGac's Avatar
  • Visitor
  • Visitor
5 years 9 months ago #180354 by LouisGac
Replied by LouisGac on topic Customizing twig template
Denis didn't force it at all, it's been very welcome.
The topic has been locked.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose