Liqiud basics
Modules
API
Mailer
Events
Overview
Below you can see all the available drops on the events object
| Name | Description |
| events.group_by_week_days | Events grouped by days of the week |
| events.group_by_month_days | Events grouped by days of the month |
| events.group_by_month_weeks | Events grouped by weeks of the month |
| events.date | The date of the events |
| events.datetime | The time for the events |
| events.start_at_desc | Sorting the start of events in descending order |
Snippets
Calendar events - To fetch all events that belongs to a calendar use:
<h2>{% assign my_cal = calendars.my_cal %}</h2>
{{ my_cal.name }}
{% for event in my_cal.events.20 %}
<p>{{ event.title }}</p>
{% endfor %}
Ongoing events - To only fetch ongoing events use:
{% for event in my_cal.ongoing_events.10 %}
<p>{{ event.title }}</p>
{% endfor %}
Upcoming events - To only fetch upcoming events use:
{% for event in my_cal.upcoming_events.10 %}
<p>{{ event.title }}</p>
{% endfor %}
Ongoing and upcoming events - To fetch ongoing and upcoming events use:
{% for event in my_cal.ongoing_and_upcoming_events.10 %}
<p>{{ event.title }}</p>
{% endfor %}
All events - To fetch Events from all calendars, use the same syntax as in the previous examples but replace 'my_cal' with 'calendars'. For example:
{% for event in calendars.ongoing_and_upcoming_events.10 %}
<p>{{ event.title }}</p>
{% endfor %}
To fetch events using an offset:
{% assign limit = 10 %}
{% assign offset = 5 %}
{% capture variables %}{{limit}}_{{offset}}{% endcapture %}
{% for event in calendar.ongoing_and_upcoming_events[variables] %}
....
{% endfor %}
Events - Advanced
Group by month days - Events can be grouped by days of the month, at the moment only events from the current month are available directly. Grouping events by month days will return an array with DateItems liquid object for all the days of the month. This is used in an horizontal calendar. For example:
{% for date in calendars.events.group_by_month_days %}
<div>{{ date.day }}</div>
{% for event in date.items %}
<div>{{ event.title }}</div>
{% endfor %}
{% endfor %}
Group by month weeks - Events can be grouped by weeks of the month, at the moment only events from the current month are available directly. Grouping events by month weeks will return an array of weeks. Each week has an array with DateItems liquid object for all the days of the week. This is used in an horizontal calendar. For example:
<table>
{% for week_days in calendars.events.group_by_month_weeks %}
<tr class="week">
{% for date in week_days %}
<td class="day">
<div class="number">{{ date.day }}</div>
<ul class="events">
{% for event in date.items %}
<li>{{ event.title }}</li>
{% endfor %}
</ul>
</td>
{% endfor %}
</tr>
{% endfor %}
</table>
- If a request url has the parameter 'calendar_date', the calendar date will default to its value.
- 'Group by month weeks' will contain weeks starting from the first week of the month, to the last week. Week will include other month days if applicable.
DateItems - Each date has the following methods:
1. date.day # day of the month 2. date.date # date attribute 3. date.today? # if the date is today 4. date.items_empty? # is items empty? 5. date.empty? # shorter method for 'items_empty?' 6. date.items # in this case the events starting in that date 7. date.different_month? # date does NOT belong to selected month? 8. date.selected_month? # date belongs to selected month?
Updated: 2020-11-17