Skip to content

Instantly share code, notes, and snippets.

@renebakx
Created July 10, 2015 14:03
Show Gist options
  • Save renebakx/9d7ea61854c05f68488a to your computer and use it in GitHub Desktop.
Save renebakx/9d7ea61854c05f68488a to your computer and use it in GitHub Desktop.
Splitting view rows in upcoming and recent on a date without creating a viewspluging
{% for index,rawdata in view.result %}
{% set row_date = rawdata.field_field_conference_date[0]['raw']['value'] %}
{% set upcoming = false %}
{% set recent = false %}
{% if date(row_date) > date() %}
{% if not upcoming %}
<small>{{ 'Upcoming'|t }}</small>
{% set upcoming = true %}
{% endif %}
{% else %}
{% if not recent %}
<small>{{ 'Recent'|t }}</small>
{% set recent = true %}
{% endif %}
{% endif %}
{{ rows[index] }}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment