Search

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.

It's quite a simple format to reproduce really, there's some detailed info here

I will be doing the same, but on another system.

Have a look here to get some idea on what is required using XSLT

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>
Attachments:
Symphony – XSLT Processing Error-1.jpg

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.

Attachments:
commodo-ipsum-amet-2

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...

https://gist.github.com/1335801

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.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details