Conditional with custom date range
I have a view on my calendar that shows the events that begin or end in the next 7 days. I've got it working well. The only problem is that the events that are ending only display if they end during the current week not the next 7 days. So if it were sunday and an event finishes the next day on Monday it wouldn't actually display until Monday giving users minimal notice. Here's the code I'm using:
{exp:low_events:entries channel="events" date="now;+1 weeks" orderby="low_events:end"}
{!-- Only show events that start or end during the week --}
{if event_dates:upcoming == 'y' || '{event_dates:ends_this_week}'}
{!-- Conditionally stash the start or end date so we can order based on it --}
{stash:order_date}{if event_dates:upcoming == 'y'}{event_dates:start_date}{if:else}{event_dates:end_date}{/if}{/stash:order_date}
{!-- Fields to display --}
{stash:title}{title}{/stash:title}
{stash:url_title}{url_title}{/stash:url_title}
{/if}
{/exp:low_events:entries}
Is there a different conditional I could use to check if the event ends in the next 7 days?
Replies
Low 19 Feb 2013 08:27
You'd have to use some PHP to get the relative date, like the start_on param explained here: http://ellislab.com/expressionengine/...
So something like this:
and then use this in your conditional
Dylan 21 Feb 2013 05:28
Thanks Low, that worked great.