FullCalender.io ICS-Plugin

I am having problems converting a working pure-html-solution to Kirby.

I am trying to load an ICS-file for a plugin (fullcalender.io). This works in pure HTML. Here is my WOKRING Code:

(at the time of this writing it runs for demo purposes on this server: https://www.kip-ol.de/_kalender/_fullcalendar/examples/icalendar_KGS.html)

As you can see: Works.

The calender itself works on my production-server as well: Kalender der KGS | KGS Rastede.
Here is my working code: site/templates/kalender.php · ics · Carsten Niehaus / Homepage · GitLab

Now to my problem:

I need to switch from using JSON as an input to using ICS as an input. For that I needed to change the code a bit using a fullcalender.io-plugin (events from an iCalendar feed - Docs | FullCalendar). As you can see above it works perfectly fine OUTSIDE of Kirby.
When I try to run the very same code as a php-template in Kirby it doesn’t load the file (‘public.ics konnte nicht geladen werden’) as if Kirby prevents the plugin to load my .ics-file. Some kind of “firewalling”.

As my code works as a regular html-file it has to be something Kirby-specific.

Any help is very much appreciated!

Here is a “proof”, that my code itself works as a pure html/js-file outside a Kirby instance:

This is the code that doesn’t work INSIDE Kirby:

   events: {
         	url : 'https://www.kip-ol.de/_kalender/_fullcalendar/examples/ics/public.ics',
         format: 'ics',
         failure: function() {
           document.getElementById('script-warning').style.display = 'block';
         }
       },

This is pure JavaScript code, so it should be working. What is the error message you get in your browser console if any? Is the Kirby version online somewhere? Where is this code used in the Kirby version? From where is the file loaded, from the same domain or a different one? Same protocol or different one. Please provide all the information that might be relevant.

The not-working Kirby-server is here: Kalender der KGS | KGS Rastede

Code: site/templates/kalender.php · ics · Carsten Niehaus / Homepage · GitLab


The working Kirby-server (as in: reading JSON instead of ICS) is here: Kalender der KGS | KGS Rastede

This is the working (JSON) file: site/templates/kalender.php · master · Carsten Niehaus / Homepage · GitLab


Working server (ICS), but without Kirby: https://www.kip-ol.de/_kalender/_fullcalendar/examples/icalendar_KGS.html

Code is here: assets/kalender/kalender.html · ics · Carsten Niehaus / Homepage · GitLab
(I didn’t include all javascript files here, just my code)

I tried a million things. In the status right now inside gitlab the console-log is:

grafik

and it fails to:

grafik

Well, according to the console error, you have an error in your script. “Missing closing }”

To be exact a curly brace is missing for the events: property.

I am sorry, that was stupid. It is now fixed, an empty kalender now shows up: Kalender der KGS | KGS Rastede

The key-issue though remains, the ics-file is not loading.

grafik

I guess this is no longer an Kirby-issue (well, it never was), I just don’t get the docs from FullCalender. Thanks for you help.

Oh my code. We found it…

I was the ORDER of the includes! We just had to switch two lines:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar/main.min.css" />
<script src='https://cdn.jsdelivr.net/npm/@fullcalendar/icalendar@5.6.0/main.global.js'></script>

Thats it… :woozy_face: