Skip to content

Instantly share code, notes, and snippets.

@adrienne
Created June 7, 2012 12:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adrienne/2888431 to your computer and use it in GitHub Desktop.
Save adrienne/2888431 to your computer and use it in GitHub Desktop.
stash events filtered by day of the week
{!-- Controller --}
{exp:channel:entries channel="events" dynamic="off" show_future_entries="yes" order_by="entry_date" sort="asc" }
{!-- group into lists by day of the week --}
{exp:stash:append_list name="events_list" context="{entry_date format='%D'}" }
{stash:entry}
<li><a href="{page_url}">{title}</a> {entry_date format="%d/%m/%y"}</li>
{/stash:entry}
{/exp:stash:append_list}
{/exp:channel:entries}
{!-- View --}
<h1>Prioritise the first event for each day for this week</h1>
<h2>Wednesday</h2>
{exp:stash:get_list name="events_list" context="Wednesday" limit="1"}
{entry}
{/exp:stash:get_list}
<h2>Friday</h2>
{exp:stash:get_list name="events_list" context="Friday" limit="1"}
{entry}
{/exp:stash:get_list}
<h2>Saturday</h2>
{exp:stash:get_list name="events_list" context="Saturday" limit="1"}
{entry}
{/exp:stash:get_list}
<hr/>
<h1>Show less information for the weeks coming</h1>
<h2>Wed</h2>
<ul>
{exp:stash:get_list name="events_list" context="Wednesday" offset="1"}
{entry}
{/exp:stash:get_list}
</ul>
<h2>Fri</h2>
<ul>
{exp:stash:get_list name="events_list" context="Friday" offset="1"}
{entry}
{/exp:stash:get_list}
</ul>
<h2>Sat</h2>
<ul>
{exp:stash:get_list name="events_list" context="Saturday" offset="1"}
{entry}
{/exp:stash:get_list}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment