Twig theme: Targeting certain pages e.g. Welcome.

Mehr
3 Monate 1 Woche her #184460 von 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.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners
Mehr
3 Monate 1 Woche her #184473 von DenisChenu
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.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
3 Monate 1 Woche her #184481 von jelo

DenisChenu schrieb: For question : it's same content, i don't see how to hide specific part except with js /css related to this question.

The simplest approach would be to have a modified layout_global.twig for the welcome page and the untouched one for every other page.

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

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
3 Monate 6 Tage her - 3 Monate 6 Tage her #184503 von tpartner
I use something like this in layout_global.twig to target different pages:

{% 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.
Official LimeSurvey Partner - partnersurveys.com
Letzte Änderung: 3 Monate 6 Tage her von tpartner.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
3 Monate 6 Tage her #184506 von jelo

tpartner schrieb: I use something like this in layout_global.twig to target different pages:

That is the approach I was looking for. Thanks.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
3 Monate 6 Tage her #184508 von DenisChenu

jelo schrieb:

DenisChenu schrieb: For question : it's same content, i don't see how to hide specific part except with js /css related to this question.

The simplest approach would be to have a modified layout_global.twig for the welcome page and the untouched one for every other page.

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.

layout_global is loaded …

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
{% 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 .
An error happen ? Before make a new topic : remind the Debug mode .
Folgende Benutzer bedankten sich: tpartner

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha