We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7231
    • 4,205 Posts
    I am wondering what is the correct file format to use for an ical feed? I am using text/plain in my test and it seems to be working with iCal (not sure if ical is more or less tolerant of formatting problems than other ical readers).

    Also will the webcal://path-to-cal-feed syntax work in IE or in Windows like it does on the mac?

    I will also need to output in hCalendar format as well, but that is more straight forward since it is looks like simple html. I need to read up on this microformat a bit more to figure out how to use it correctly.
      [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

      Something is happening here, but you don't know what it is.
      Do you, Mr. Jones? - [bob dylan]
      • 25663 MODX Staff
      • 12,272 Posts
      Hey Shane, did you ever make it much further along on getting iCal/hCal output going?
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 7231
        • 4,205 Posts
        Yes, it worked fine well, and we had multiple categories to subscribe with a single feed. However it is not live yet since the event calender is not ready (the client opted to release the site in stages).

        I will need to go back and look at the code to remember how I did it.
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don't know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 7231
          • 4,205 Posts
          Here is the skinny:
          1) modx document set to content type: text/plain and Inline
          2) setup your feed format. I used this:
          BEGIN:VCALENDAR
          VERSION:2.0
          X-WR-CALNAME: My Events [[getCat]]
          PRODID:-//Apple Computer\, Inc//iCal 2.0//EN
          [!snippet-to-populate-feed!]
          END:VCALENDAR


          Note: the getCat snippet is to append the category name to the feed title, it is not required.

          To populate the feed i used Ditto for the demo but will be using a custom setup for the final. Int he Ditto tpl I have (note this is a demo so it may be a bit crude):
          BEGIN:VEVENT
          DTSTART:[+editedon:date=`%Y%d%mT%H%M%SZ`+]
          DTEND:[+eventDate_end:isnot="":then=`[+eventDate_end:date=`%Y%d%mT%H%M%SZ`+]`+]
          SUMMARY:[+longtitle+] - [[GetField? &docid=`[+id+]` &parentLevel=`0` &field=`longtitle` &parent=`1`]]
          DTSTAMP:[+editedon:date=`%Y%d%mT%H%M%SZ`+]
          END:VEVENT


          And here is the important part. In the feed link you need to use:
          webcal://url-to-the-fee-.com/feed-link


          Otherwise it will just be a text page. This is all based on my own conclusions, I am not an expert at any microformat or the webcal protocol so this may be totally off. If you do find out something please let me know since this will be needed soon for my project  grin

            [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

            Something is happening here, but you don't know what it is.
            Do you, Mr. Jones? - [bob dylan]
            • 25663 MODX Staff
            • 12,272 Posts
            Some minor tweaks to the above to get it to work (as discussed via PM) mostly included the date format was flipping the month and day order. Here’s what I wound up using for anyone that’s interested:

            For the page template (blank, text/inline, etc.):
            BEGIN:VCALENDAR
            VERSION:2.0
            X-WR-CALNAME:[*longtitle*]
            X-WR-CALDESC:[*introtext*]
            X-WR-TIMEZONE:US/Central
            PRODID:-//MODx iCal Feed//iCal 2.0//EN
            [!Ditto? &parents=`30,31` &display=`all` &tpl=`ical_tpl` &sortBy=`EasyEventsStart` &sortDir=`ASC`!]
            END:VCALENDAR


            And in my case here’s the ical_tpl chunk (also used with Easy Events). Note, we used custom start/end date widgets and had to set an output widget of unixtime to get the formatting via PHx to work (and the extra return at the end is important):
            BEGIN:VEVENT
            DTSTART;TZID=US/Central:[+EasyEventsStart:date=`%Y%m%dT%H%M%S`+]
            [+EasyEventsEnd:isnot="":then=`DTEND;TZID=US/Central:[+EasyEventsEnd:date=`%Y%m%dT%H%M%S`+]`+]
            [+EventLocation:isnot="":then=`LOCATION:[+EventLocation+]`+]
            SUMMARY:[+pagetitle+]: [+description+]
            DTSTAMP:[+editedon:date=`%Y%m%dT%H%M%SZ`+]
            END:VEVENT
            
            


            Caveat: I can’t seem to get the Timezone to work right. Timezone is working now.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 7231
              • 4,205 Posts
              I think it is required that you set a time zone definition in the feed http://www.kanzaki.com/docs/ical/vtimezone.html
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don't know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 25663 MODX Staff
                • 12,272 Posts
                I think it’s optional, actually. I originally had the timezone spec’d as US-Central instead of US/Central, which works apparnetly. Of course it could have been anything else, too. I also added a location to the example above. Thanks so much for your help Shane!
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 7231
                  • 4,205 Posts
                  Quote from: rthrash at Mar 12, 2009, 08:35 PM
                  Thanks so much for your help Shane!
                  Ahh, but it is I who thank you since I will need to work on this again in the next few weeks and now it is ironed out grin
                    [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                    Something is happening here, but you don't know what it is.
                    Do you, Mr. Jones? - [bob dylan]