Welcome to the LimeSurvey Community Forum

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

{{ aQuestion }} is empty

  • Shaogul
  • Shaogul's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 4 days ago - 3 years 4 days ago #213980 by Shaogul
{{ aQuestion }} is empty was created by Shaogul
hi there

im having real troubles creating my own theme in LS [url=http://localhost/limesurvey/index.php/admin/questions/sa/view/surveyid/139476/gid/1/qid/1#modalSystemInformation]3.25.19+210323[/url]. in my question view, i want to display the question code, therefore i tried using {{ aQuestion.code }}, just as it is used in the vanilla theme. the problem ist, the variable is empty and returns NULL. I have searched the forum, read the manual on creating themes and haven't found anything that would help. am i missing something?

(im running limesurvey on xampp on windows 10)

cheers
Last edit: 3 years 4 days ago by Shaogul.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 days ago #213999 by tpartner
Replied by tpartner on topic {{ aQuestion }} is empty
{{ aQuestion }} will never work because aQuestion is an array. You need to use the dump function.

What file are you trying to place it in?

Both of these work in, for example, question_text_content.twig.

Code:
{{ dump(aQuestion) }}

Code:
{{ aQuestion.code }}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Shaogul
  • Shaogul's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 3 days ago #214017 by Shaogul
Replied by Shaogul on topic {{ aQuestion }} is empty
hey, thx for the quick reply

​​​​​​so i used the dump function to see whats in the array, it just returned NULL. i used it in question.twig which i included in my main.twig

The topic has been locked.
More
3 years 3 days ago #214031 by jelo
Replied by jelo on topic {{ aQuestion }} is empty

Both of these work in, for example, question_text_content.twig.

Perhaps a LimeSurvey version issue?  LS 3.25.19+210323 may be the reason.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 days ago #214035 by tpartner
Replied by tpartner on topic {{ aQuestion }} is empty

Both of these work in, for example, question_text_content.twig.

Perhaps a LimeSurvey version issue?  LS 3.25.19+210323 may be the reason.
Yes, perhaps. They both work for me in question.twig using version 3.25.8.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Shaogul
  • Shaogul's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 3 days ago #214037 by Shaogul
Replied by Shaogul on topic {{ aQuestion }} is empty
hmm, i just installed version 3.25.0 and got the same problem :( no idea why..
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 days ago #214041 by tpartner
Replied by tpartner on topic {{ aQuestion }} is empty
Can you attach your code?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Shaogul
  • Shaogul's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 3 days ago - 3 years 3 days ago #214047 by Shaogul
Replied by Shaogul on topic {{ aQuestion }} is empty
attached main and question twigs. i noticed, that i had to include main.twig in layout_global.twig, otherwise it wouldn't load it. in vanilla the main.twig seems to be included without using {{ include(main.twig) }}. 
Last edit: 3 years 3 days ago by Shaogul.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 days ago #214055 by DenisChenu
Replied by DenisChenu on topic {{ aQuestion }} is empty
{{ dump(aQuestion) }} work only with debug mode.

aQuestion is in aGroup in aSurveyInfo at this time
github.com/LimeSurvey/LimeSurvey/blob/08...ntimeHelper.php#L511

Then : it sedn as aQuestion ONLY in quetsion.twig not before.

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: Shaogul
The topic has been locked.
  • Shaogul
  • Shaogul's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 days ago - 3 years 2 days ago #214116 by Shaogul
Replied by Shaogul on topic {{ aQuestion }} is empty
yeah i had debug mode on. oh i see, i directly included the question twigs in the main twig. i extended another vanilla and kept the filestructure with the group twigs included, now it works :) thanks alot 
Last edit: 3 years 2 days ago by Shaogul.
The following user(s) said Thank You: DenisChenu
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose