Skip to content

Case Statement

harrydeluxe edited this page May 13, 2012 · 1 revision

If you need more conditions, you can use the case statement:

{% case condition %} 
  {% when 1 %} 
    hit 1 
  {% when 2 or 3 %} 
    hit 2 or 3
  {% else %} 
    ... else ... 
{% endcase %} 

Example:

{% case template %}
  {% when 'label' %}
    {{ label.title }}
  {% when 'product' %}
    {{ product.vendor | link_to_vendor }} / {{ product.title }}
  {% else %}
    {{ page_title }}
{% endcase %}
Clone this wiki locally