O
O
Ovilon2019-03-03 00:39:53
Twig
Ovilon, 2019-03-03 00:39:53

Twig_Error_Syntax due to second for on page?

An error is thrown:

Fatal error: Uncaught exception 'Twig_Error_Syntax' with message 'Unexpected "i" tag (expecting closing tag for the "for" tag defined near line 46) in...

Swears at:
{% set i = 1 %}
{% for i in 1..banners|length %}
#slideshow div:nth-child( {% i %} ) { animation-delay: {% i %}s;  }
{% endfor %}

This is a piece of css.
Moreover, I already called for above:
<div id="slideshow{{ module }}">{% for banner in banners %}
<div style='background-image: url("{{ banner.image }}"); display: block;'></div>
{% endfor %}

Maybe two for is a lot for twig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor, 2019-03-03
@Ovilon

{{ i }} instead of {% i %}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question