使用 ColdFusion 在网页上添加"Add to calendar"



我正在寻找ColdFusion代码,将"添加到日历"链接添加到我们的活动页面,类似于EventBrite和Meetup.com上的链接。他们有将活动添加到Outlook、Google和iCal日历的链接。如果有其他语言的代码具有类似的功能,我可以使用它。

以下是为特定日历事件提供.ics文件的示例:

<cfset ICSContent = "">
<cfset ICSContent = ICSContent & "BEGIN:VCALENDAR#chr(13)##chr(10)#">
<cfset ICSContent = ICSContent & "VERSION:2.0#chr(13)##chr(10)#">
<cfset ICSContent = ICSContent & "CALSCALE:GREGORIAN#chr(13)##chr(10)#">
<cfset ICSContent = ICSContent & "PRODID:Coldfusion8#chr(13)##chr(10)#">
<cfset ICSContent = ICSContent & "BEGIN:VEVENT#chr(13)##chr(10)#">
<cfset ICSContent = ICSContent & "UID:#eventItem.getEvent_id()#@extension.unh.edu#chr(13)##chr(10)#">
<cfset ICSContent = ICSContent & "SUMMARY:#eventItem.getTitle()##chr(13)##chr(10)#">
<cfset ICSContent = ICSContent & "DESCRIPTION:http://extension.unh.edu/events/index.cfm?e=app.event&event_id=#eventItem.getEvent_id()##chr(13)##chr(10)#">
<cfset ICSContent = ICSContent & "DTSTART:#DateFormat(DateAdd('h',timeInfo.utcHourOffset,eventItem.getGmt_start()),"yyyymmdd")#T#TimeFormat(DateAdd('h',timeInfo.utcHourOffset,eventItem.getGmt_start()),"HHmmss")#Z#chr(13)##chr(10)#">
<cfset ICSContent = ICSContent & "DTEND:#DateFormat(DateAdd('h',timeInfo.utcHourOffset,eventItem.getGmt_end()),"yyyymmdd")#T#TimeFormat(DateAdd('h',timeInfo.utcHourOffset,eventItem.getGmt_end()),"HHmmss")#Z#chr(13)##chr(10)#">
<cfset ICSContent = ICSContent & "DTSTAMP:#DateFormat(DateAdd('h',timeInfo.utcHourOffset,Now()),"yyyymmdd")#T#TimeFormat(DateAdd('h',timeInfo.utcHourOffset,Now()),"HHmmss")#Z#chr(13)##chr(10)#">
<cfset ICSContent = ICSContent & "END:VEVENT#chr(13)##chr(10)#">
<cfset ICSContent = ICSContent & "END:VCALENDAR">
<cfheader name="Content-Type" value="text/calendar">
<cfheader name="Content-Disposition" value="attachment; filename=UNHCEevent#DateFormat(eventItem.getGmt_start(),"yyyymmdd")#.ics">
<cfoutput>#ICSContent#</cfoutput>

我相信您可能正在讨论生成一个ical字符串。这里似乎涵盖了这一点:https://stackoverflow.com/a/2946423/52160

相关内容

  • 没有找到相关文章

最新更新