1

I'm trying to have this include be updated by the option I choose in my dropdown.

{% include 'subnav_programs.html' %}

My dropdown is called entry.dropSubsection

I put {% include '{{ entry.dropSubsection }}' %} in my html file but it keeps giving me errors.

I get this error:

Unable to find the template “{{ entry.dropSubsection }}”.

0

1 Answer 1

3

You don't need to (more specifically, you can't) nest Twig tags within other Twig tags. Ditch the inner Twig tag and its respective quotes, and just pass the variable directly into the outer Twig tag...

{% include entry.dropSubsection %}

That being said, I'm not sure this will achieve exactly what you're looking for. You may need to append .value as well...

{% include entry.dropSubsection.value %}
2
  • Im still getting errors : Unable to find the template “{% include 'subnav_programs.html' %}”. I'm not sure its processing the quotes outputted from the dropdown properly. The dropdown value is: 'subnav_programs.html'
    – kingkelly
    Commented Jan 14, 2018 at 22:51
  • That error message seems wrong, it should simply say Unable to find the template “subnav_programs.html”. If it's really spitting out the full Twig tag, then it looks like you are includeing a whole other include tag.
    – Lindsey D
    Commented Jan 15, 2018 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.