Skip to content

Instantly share code, notes, and snippets.

@rruhlen
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rruhlen/8867844 to your computer and use it in GitHub Desktop.
Save rruhlen/8867844 to your computer and use it in GitHub Desktop.
how to ignore and detect a topic when looping through the topic array. Also included is an if/else statement which allows you to do both in the for loop and style each HTML it spits out differently.
{% if topics_count > 0 %}
{% for topic in topics %}
{% if topic.article_count > 0 %}
{% unless topic.id == 393291 %}
HTML goes here
{% endunless %}
{%endif%}
{% endfor %}
{%endif%}
{% if topics_count > 0 %}
{% for topic in topics %}
{% if topic.article_count > 0 %}
{% if topic.id == 393291 %}
HTML goes here
{% elsif topic.id == 456188 %}
HTML goes here
{% else %}
HTML goes here
{% endif %}
{%endif%}
{% endfor %}
{%endif%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment