8000 [Templating] Fix odd/even cycle · symfony/symfony-docs@296a0a0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 296a0a0

Browse files
committed
[Templating] Fix odd/even cycle
As i now starts at 1 and cycle() uses the modulo operator, the second list item is used for the first element. This means odd/even have to be switched. See http://twigfiddle.com/8amvok
1 parent bbef239 commit 296a0a0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

templating.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ with alternating ``odd``, ``even`` classes:
109109
.. code-block:: html+twig
110110

111111
{% for i in 1..10 %}
112-
<div class="{{ cycle(['odd', 'even'], i) }}">
112+
<div class="{{ cycle(['even', 'odd'], i) }}">
113113
<!-- some HTML here -->
114114
</div>
115115
{% endfor %}

0 commit comments

Comments
 (0)
0