Posted on April 10, 2012 by Michael Rosario
Total Posts: 33 | Join date: 03-12-11
{exp:channel:entries channel="events" status="not closed" show_future_entries="yes" disable="member_data|pagination|trackbacks|categories" show_expired="yes" orderby="date" sort="asc" limit="1"}
<?
ob_start(); //start internal buffer
header('Content-type: text/calendar');
header('Content-Disposition: attachment; filename="events-{entry_date format='%Y%m%dT%H%i%sZ'}.ics"');
?>
BEGIN:VCALENDAR
PRODID:-//COMPANY/ Event//NONSGML v1.0//EN
CALSCALE:GREGORIAN
X-WR-CALNAME:COMPANY
VERSION:2.0
METHOD:PUBLISH
TRANSP:TRANSPARENT
X-WR-TIMEZONE:America/New_York
BEGIN:VEVENT
UID:{entry_id}
{if event-day == "Yes"}
DTSTART;VALUE=DATE:{entry_date format="%Y%m%d"}
<? $month = "{expiration_date format='%m'}"; $day = "{expiration_date format='%d'}"; $year = "{expiration_date format='%Y'}"; $d = mktime(0,0,0,$month,$day,$year); $end_date = date("Ymd",strtotime("+1 days",$d)); ?>
DTSTAMP:{entry_date format="%Y%m%dT%H%i%sZ"}
DTEND;VALUE=DATE:<? echo $end_date; ?>
{if:else}
DTSTAMP:{entry_date format="%Y%m%dT%H%i%sZ"}
DTSTART;VALUE=DATE:{entry_date format="%Y%m%dT%H%i%s"}
DTEND;VALUE=DATE:{expiration_date format="%Y%m%dT%H%i%s"}
{/if}
SUMMARY:<? $title="{title}"; $title=str_replace("amp;","",$title); echo $title; ?>
DESCRIPTION:{event-description}
URL:{title_permalink="news_and_events/event_detail"}
END:VEVENT
END:VCALENDAR
<?
$event = ob_get_contents();
ob_end_clean();
flush();
echo $event;
?>
{/exp:channel:entries}
Tags: There are no tags for this entry.