Created
June 12, 2011 23:50
-
-
Save weaverryan/1022139 to your computer and use it in GitHub Desktop.
Why I love Twig - space control, loop index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# the "{%-" and "-%}" syntax sucks all of the spaces left and right of that tag #} | |
{# reference: http://www.twig-project.org/doc/templates.html#whitespace-control #} | |
<a href="{{ upload_path('post_photo', photo.photoPath) }}" class=" | |
{%- if loop.index is divisibleby(3) %}last {% endif -%} | |
{%- if loop.index > 3 %}not_first_row{% endif -%} | |
"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="{{ upload_path('post_photo', photo.photoPath) }}" class="last not_first_row"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is indeed awesome!