Welcome to the LimeSurvey Community Forum

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

Dynamic "The following surveys are available:" text

  • tomprobst
  • tomprobst's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 4 months ago - 4 years 4 months ago #191862 by tomprobst
Hi,

On the Survey List page, I'd like the "The following surveys are available:" text to be dynamic.

I'm assuming the best way to do this is an {%if %} in the theme template, something like:

{% if (are_there_any_active_and_publicly_published_surveys_variable < 1)%}
<p>There are no surveys available</p>
{%else%}
<p>The following surveys are available:</p>
{%endif%}

Good idea to do it this way?

My question is, what variable would I use?

Thanks

Thanks
Last edit: 4 years 4 months ago by tomprobst.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 4 months ago - 4 years 4 months ago #191882 by tpartner
Try something like this in layout_survey_list.twig:

Code:
{% if aSurveyInfo.publicSurveys|length > 0 %}
    {{ gT("The following surveys are available:") }}
{% else %}
    There are no surveys available.
{% endif %}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 4 months ago by tpartner.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose