Calendar:ICS_Export template tag
Calendar:ICS_Export
The Calendar:ICS_Export tag allows visitors to export events as calendar files. It outputs an ICS (RFC-2445)-compatible file that can be imported into most calendar applications, including Google Calendar, Apple Calendar, and Microsoft Outlook.
This tag generates a fully pre-formatted ICS file, so all you need to do is place the tag in a template, apply the desired parameters, and link to that template. When the template is accessed, the browser will immediately download the .ics file to the user's computer.
If you're looking to provide a one-way calendar subscription instead of a one-time download, see the Calendar:ICS_Subscription tag documentation.
{exp:calendar:ics_export}
Parameters
date_range_start
This parameter allows you to show a specific date range to export events for. Enter the beginning day you'd like this tag to show results for. If this parameter is NOT specified or an incorrect date value is passed to this parameter, the current day (today) will be displayed. Both standard and easy-to-use text date formatting apply to this parameter. Used in conjunction with the date_range_end parameter. E.g. date_range_start="2 months ago".
date_range_end
This parameter allows you to show a specific date range to export events for. Enter the ending day you'd like this tag to show results for.If this parameter is NOT specified or an incorrect date value is passed to this parameter, the current day (today) will be displayed. Both standard and easy-to-use text date formatting apply to this parameter. Used in conjunction with the date_range_start parameter. E.g. date_range_end="100 months".
calendar_id
This parameter allows you to export a specific calendar by specifying its ID. You can hardcode a calendar ID, pass it through an embed, or grab it from the URI. This link should be generated in another template by using the {calendar:calendar_id} variable. E.g. calendar_id="{segment_4}".
event_id
This parameter allows you to export a specific event by specifying its ID. You can hardcode an event entry ID, pass it through an embed, or grab it from the URI. This link should be generated in another template by using the {entry_id} or {calendar:entry_id} variable. E.g. event_id="{segment_4}".
category
This parameter allows you to export a specific set of events that belong to a category within a certain calendar by specifying a category ID. You can hardcode an category ID, pass it through an embed, or grab it from the URI. E.g. category="{segment_5}".
Examples
The below code example is a complete example of how you would use this feature to export a range of events:
{exp:calendar:ics_export
date_range_start="2 months ago"
date_range_end="100 months"
}
If you wish to export a single event or calendar, your code would look something more like this:
{exp:calendar:ics_export
{if segment_3 == "event"}
event_id="{segment_4}" {!-- Assuming linking like: site.com/calendar/export/event/53 --}
{/if}
{if segment_3 == "calendar"}
calendar_id="{segment_4}" {!-- Assuming linking like: site.com/calendar/export/calendar/4 --}
{/if}
date_range_start="2 months ago"
date_range_end="100 months"
}