- Posts: 4
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Customizing twig template
- apires
- Topic Author
- Offline
- New Member
Less
More
5 years 2 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
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
Attachments:
The topic has been locked.
- LouisGac
- Visitor
5 years 2 months ago #180336
by LouisGac
Replied by LouisGac on topic Customizing twig template
you should read this article:
manual.limesurvey.org/New_Template_System_in_LS3.x
manual.limesurvey.org/New_Template_System_in_LS3.x
The topic has been locked.
- apires
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
5 years 2 months ago - 5 years 2 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.
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 2 months ago by apires.
The topic has been locked.
- apires
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
5 years 2 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.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
5 years 2 months ago #180339
by jelo
To display variables like in LS2, you should try processString.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Customizing twig template
It's still very messy. Not every twig template is correctly getting every variable.apires wrote: I've tryied with 1 and 2 bracelets {{ }} and nothing..
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
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
5 years 2 months ago #180350
by apires
Replied by apires on topic Customizing twig template
God bless you!! It works now )
Many thanks
Cheers
Many thanks
Cheers
The topic has been locked.
- jelo
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
5 years 2 months ago #180353
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Customizing twig template
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 hereapires wrote: God bless you!! It works now )
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- LouisGac
- Visitor
5 years 2 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.