1
votes

In my twig template, I have some nested loops that look like this:

    {% for i in 1..6 %}

            {% for stat in dailyStats %}

                    {$ if stat.dayOfWeek == i and i < date('w') $}

                        //DO SOMETHING HERE

                    {% elseif i < date('w') %}

                        //DO SOMETHING HERE

                    {% else %}

                        //DO SOMETHING HERE

                    {% endif %}

            {% endfor %}

    {% endfor %}

I am getting this error: "Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unexpected tag name "elseif" (expecting closing tag for the "for" tag defined near line..."

It seems as though there is a problem with my elseif statement, but I don't know why this would be a problem.

1

1 Answers

9
votes

On your if statement, you used $ instead of %.