Skip to content

Instantly share code, notes, and snippets.

@johnkary
Created December 13, 2011 20:33
Show Gist options
  • Save johnkary/1473755 to your computer and use it in GitHub Desktop.
Save johnkary/1473755 to your computer and use it in GitHub Desktop.
How to get Twig support for $$var like syntax?
{% for i in 0..50 %}
{% set someanswer = 'answer_' ~ i %}
{% if form.{{someanswer}} is defined %}
<div class="question">
{{ form_label(form.{{someanswer}}) }}
{{ form_errors(form.{{someanswer}}) }}
{{ form_widget(form.{{someanswer}}_0, {'attr': {'class':'test_choices'} }) }}
</div>
{% endif %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment