2

I want to show future events based on today.

I currently have 3 dummy events in my system, 1 past, 1 today, 1 future. When I run the code below no events show up:

{exp:calendar:events event_limit="3" status="open" date_range_start="today" orderby="event_start_date" sort="asc"}

If I take out the parameter:

date_range_start="today"

Then all appear.

I'm running the same query for past events using:

date_range_end="yesterday"

This is working fine.

2 Answers 2

0

The tag you're very likely looking for is {exp:calendar:cal}, not {exp:calendar:events}. This is almost always the tag to use when displaying upcoming/future events (or past events, or events within a specific timeframe) is the goal.

{exp:calendar:cal} is the only tag that creates a truly chronological list of events and respects the time/date window set in date_range_start="" and date_range_end="" (i.e. it looks for events/occurrences within the set timeframe).

(Note: add pad_short_weeks="n" as well to {exp:calendar:cal} to avoid it from adding extra days in your timeframe to complete a calendar "week row")

The following documentation page, which explains in more details why/when each of the main Calendar tags are used, is a strongly recommended read: http://www.solspace.com/docs/calendar/getting_started/

1
  • Hi, thanks for your response. I updated my "upcoming events" code to use cal which is now working, thank you. However when I add the parameter pad_short_weeks="n" it fails to return any results so I have removed this. Secondly I don't see a way of ordering results, does this mean that the results are automatically chronological? Thirdly if I use cal for the "past events" it returns future events, I'm updating the parameters to provide only a date_range_end="today". I presume this means cal is only used to retrieve future events ??
    – KoalaKid
    Feb 24, 2014 at 21:08
0

If you look at the events documentation. Notice how the date range end parameter. Defaults to today. You just need to specify a date range end for the events tag to be used this way.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.