Your CalDAV / Webcal / ICS Solution?

Heyho…
is anyone in here using CalDAV or Webcal or ICS to display “external” calendar-events? What’s your solution?

At our group, we use Nextcloud with its calendar and want to show events on our website - integrated into our design.

i found this plugin, but for us it’s 100% clear, that we don’t want to use third party services - especially from global players like google.

You mean like this: https://kgsrastede.de/

The calender in the top right and the “Kalender” subpage (https://kgsrastede.de/allgemeines/kalender) is reading a ICS-file, displaying it using fullcalender.io

1 Like

We are create our calendar in Outlook and saving that as an ICS-File

Then we parse the ICS and creat JSON. You can have a look at our code here:

https://git.kgsrastede.de/KGS-Rastede/homepage/src/branch/master/site/templates/ics2json.php

To renew the JSON I simply re-export the ics and call the PHP file. I never came around to play with webhooks. That should be possible as well, just never really put time into that.

Does this help?

1 Like

@demlak You might also find two of my plugins useful

Reccur - for handling recurring dates (these also work with fullcalender.io since rrules are a standard)

Yasumi - get all public holidays for any country in the world (useful for excluding events that fall on those dates)

2 Likes

@jimbobrjames Thx a lot… but we manage calendar-entries only via nextcloud…

@carsten_kgs thx a lot… this maybe will help us

Hi @demlak :slight_smile:

I have exactly the same problem: automatically getting next cloud calendar dates and display it on the Kirby website.

Did you find a solution for this?

Best
Nahuel

Nope… i do it in reverse now:
i manage the calendar entries via kirby and push them to the nextcloud caldav-calendar

1 Like

haha ok :smiley:

Not sure if useful, but I use the following PHP ICS parser library for parsing an external .ics file in a Kirby project. Works nicely for me. Probably should have rather been a plugin, but I basically just composer required it on root and use it in the controller like that.

We are still basically using what I wrote 2 years ago… the code is now on Gitlab

We are regenerating once per day, but this is a arbitrary number… if you are interested I can give you all the code


class kalender_update {
    private string $cache_file;
    private string $ics_file;
    
    // Konstruktor der Klasse, wird beim Erstellen aufgerufen
    public function __construct(string $cache_file, string $ics_file)
    {
        $this->cache_file = $cache_file;
        $this->ics_file = $ics_file;
    }
    /* Die Hauptmethode, die von aussen aufgerufen werden kann
        Es wird geprüft, ob der Kalender aktuell ist indem die Cache Datei ausgelesen wird, die einen Datumsschlüssel mit dem Datum des letzten Abgleichs mit dem IServ besitzt
        Ist dieser Schlüssel aktuell passiert nichts, ist der Schlüssel nicht aktuell wird eine neue Kalender .ics bei IServ angefragt
    */
    public function checkForUpdate()
    {

Hi @carsten_kgs that looks great, so it’s fetching the calendar data and feeding it into the website? Yes I would love to know how this works!

Thank you
Nahuel

Is that what you mean?

That fetches a ics from another site and display it using fullcalendar.io

1 Like

Hi @carsten_kgs this is looking good! I think it might work, in our setup there is a nextcloud calendar that I need to fetch (probably the same way as you did) and then somehow render the content into our layout (I guess fulcalender.io is just one way of doing that second part)

Hi

Here is the php/html for the calendar itself:

This code grabs the .ics file every 24h

while this is the actual magic:

In this very line (assets/kalender/kalender-update.php · master · Carsten Niehaus / Homepage · GitLab) you can see that we are only fetching the data at 00:17 o’clock (more or less a random number without a specific meaning).

I hope this helps