ICS File
This is an open discussion with 9 replies, filed under General.
Search
Thanks. I've created the file. Unfortunately I get an error. I've attached a snapshot of the page with the error.
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet exclude-result-prefixes="saxon xs" version="2.0" xmlns:saxon="http://icl.com/saxon" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output encoding="utf-8" indent="no" method="text" omit-xml-declaration="yes" media-type="text/calendar"/> <xsl:template match="data/event/entry"> <xsl:text>BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Zoosh Me!/Calendar Creator//NONSGML v1.0//EN BEGIN:VEVENT DTSTART:</xsl:text><xsl:value-of select="translate(contentdata/times/startdate, '-', '')"/>T<xsl:value-of select="translate(contentdata/times/starttime, ':', '')"/><xsl:text>00Z DTEND:</xsl:text><xsl:value-of select="translate(contentdata/times/enddate, '-', '')"/>T<xsl:value-of select="translate(contentdata/times/endtime, ':', '')"/><xsl:text>00Z SUMMARY:</xsl:text><xsl:value-of select="title"/><xsl:text> LOCATION:</xsl:text><xsl:value-of select="location"/><xsl:text> END:VEVENT END:VCALENDAR </xsl:text> </xsl:template> </xsl:stylesheet>
Sorry. I've noticed it was an XSL 2.0 declaration so I changed it to 1. I've installed the Content Type Mappings extension. I've added the x-vcard page type.
'content-type-mappings' => array( 'xml' => 'text/xml; charset=utf-8', 'text' => 'text/plain; charset=utf-8', 'x-vcard' => 'application/vcard; charset=utf-8', ),
What I'm getting is a file with a extra text at the top. I don't know where it comes from.
I think I know what that text is. It's all the global parameters. This is really weird.
I got this to work about a month ago. Try this...
Thank you bzerangue. This works well.
I'm having some issues with timezones. Is there a way I could pass the $timezone default parameter from the generated xml?
Yeah, simply by doing <xsl:value-of select="$timezone" />
.
I think it should be in the format required by an .ics file. Such as US/Central. Europe/London.
If you want the sitewide value in there I guess you can hard-code it but if you want it interchangeable per entry you'll have to add a Select Box to your section with all the possible timezones.
Create an account or sign in to comment.
I'd like to create an ICS file from the information that a client provides for an event in a backend form. Is there a template for such a type of file? How would I go about it? Would I have to create a page of ICS type?
I would need a template for an ICS file. Does anybody know where I could find one? The files that I've exported from iCal are a little bit confusing.