- Posts: 5033
- Thank you received: 1257
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Twig theme: Targeting certain pages e.g. Welcome.
- jelo
- Topic Author
- Offline
- Platinum Member
Less
More
4 years 11 months ago #184460
by jelo
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Twig theme: Targeting certain pages e.g. Welcome. was created by jelo
Is it possible to hide e.g. certain parts of layout_global.twig when e.g. the welcome page is displayed?
Or a certain question?
The logic would be "If not welcomepage then display ... <DIV>...</DIV>".
Is there an example to learn from?
Thanks in advance.
Or a certain question?
The logic would be "If not welcomepage then display ... <DIV>...</DIV>".
Is there an example to learn from?
Thanks in advance.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13637
- Thank you received: 2491
4 years 11 months ago #184473
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Twig theme: Targeting certain pages e.g. Welcome.
You can use aSurveyInfo.include_content twig variable to know what content ar loaded.
For question : it's same content, i don't see how to hide specific part except with js /css related to this question.
For question : it's same content, i don't see how to hide specific part except with js /css related to this question.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- jelo
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
4 years 11 months ago #184481
by jelo
A let me ask the question in a different way:
How can the "layout_global.twig" become flexible, to e.g. hide a div-section on the welcome page only. If I got you right, the TWIG "if" won't help me when it comes to page context? But the options of themes work in the same way, when it comes to hiding/showing parts.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
Replied by jelo on topic Twig theme: Targeting certain pages e.g. Welcome.
The simplest approach would be to have a modified layout_global.twig for the welcome page and the untouched one for every other page.DenisChenu wrote: For question : it's same content, i don't see how to hide specific part except with js /css related to this question.
A let me ask the question in a different way:
How can the "layout_global.twig" become flexible, to e.g. hide a div-section on the welcome page only. If I got you right, the TWIG "if" won't help me when it comes to page context? But the options of themes work in the same way, when it comes to hiding/showing parts.
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10108
- Thank you received: 3593
4 years 11 months ago - 4 years 11 months ago #184503
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 Twig theme: Targeting certain pages e.g. Welcome.
I use something like this in layout_global.twig to target different pages:
Code:
{% if (aSurveyInfo.aNavigator.show and aSurveyInfo.include_content == 'firstpage') %} <!-- Do something in the Welcome page --> {% endif %} {% if (aSurveyInfo.aNavigator.show and aSurveyInfo.include_content != 'firstpage') %} <!-- Do something in question pages --> {% endif %} {% if (aSurveyInfo.aNavigator.show == null) %} <!-- Do something in the End page --> {% endif %}
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 11 months ago by tpartner.
The topic has been locked.
- jelo
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 5033
- Thank you received: 1257
4 years 11 months ago #184506
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 Twig theme: Targeting certain pages e.g. Welcome.
That is the approach I was looking for. Thanks.tpartner wrote: I use something like this in layout_global.twig to target different pages:
The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13637
- Thank you received: 2491
4 years 11 months ago #184508
by DenisChenu
You can't disable this …
BUT :
There are way to extend it …
1. Create a new layout_default.twig (copy of current BUT with more block )
2. Delete whole in layout_global to put
Your alternative layout can extend layout_default : gitlab.com/SondagesPro/SurveyThemes/skel..._survey_list.twig#L1
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Twig theme: Targeting certain pages e.g. Welcome.
layout_global is loaded …jelo wrote:
The simplest approach would be to have a modified layout_global.twig for the welcome page and the untouched one for every other page.DenisChenu wrote: For question : it's same content, i don't see how to hide specific part except with js /css related to this question.
A let me ask the question in a different way:
How can the "layout_global.twig" become flexible, to e.g. hide a div-section on the welcome page only. If I got you right, the TWIG "if" won't help me when it comes to page context? But the options of themes work in the same way, when it comes to hiding/showing parts.
You can't disable this …
BUT :
There are way to extend it …
1. Create a new layout_default.twig (copy of current BUT with more block )
2. Delete whole in layout_global to put
Code:
{% if ( aSurveyInfo.include_content == 'firstpage') %} {% include './layout_firstpage.twig' {% else %} {% include './layout_default.twig' {% endif %}
Your alternative layout can extend layout_default : gitlab.com/SondagesPro/SurveyThemes/skel..._survey_list.twig#L1
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: tpartner
The topic has been locked.