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

Plus d'informations
il y a 2 mois 2 jours #184460 par 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

Connexion ou Créer un compte pour participer à la conversation.

LimeSurvey Partners
Plus d'informations
il y a 2 mois 1 jour #184473 par 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 .

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 1 jour #184481 par jelo

DenisChenu écrit: 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

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 1 jour - il y a 2 mois 1 jour #184503 par 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
Dernière édition: il y a 2 mois 1 jour par tpartner.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 1 jour #184506 par jelo

tpartner écrit: 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

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 1 jour #184508 par DenisChenu

jelo écrit:

DenisChenu écrit: 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 .
Les utilisateur(s) suivant ont remercié: tpartner

Connexion ou Créer un compte pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!