Archiving events

I have general question - its not problem yet but i have site which creates about 10 new events a month. I would like to archive past events somehow so they dont show up in big pile of outdated events.

The only idea that i got is use cron script to move past events pages somewhere else (like subfolder archive). The problem with that are urls. I would like to have events to have same urls. I just dont want panel users to see the old events in panel. Even more precisely - i want them to be able to see all events (event the past ones) if they wish too but by default just show the current ones.

I guess i would need some kind of panel field that would allow showing pages by dates… i guess something like this but not only for structure fields…

Ok since nothing like that exists i guess i have to write it myself so i guess ive answered my question.

Maybe somebody may have other ideas? THX

I assume you events have a date field? Than you can just filter by that date field. And show outdated events in an archive page.

Yes but i am looking for doing that in panel so people can see and edit the past events if nessecary.

Then maybe move them but still make them available via the same URL by using a route?

This could work, but then i get to whole other issue of duplicate urls since panel wont be able to prevent users from inserting already existing event names (this could happen very easily in my case).

I guess its good idea to have some kind of field for generaly listing and sorting bigger amount of subpages. Ive just never written field before.

I think in your case I wouldn’t use a field but a widget or even use a new page in the panel which would allow you to filter pages (e.g. using datatables. js).

Whats the difference between field and widget? I thought widget in kirby means “field” showing in dashboard.

Anyways i have almost empty page for that /events that currently could hold more complex field (showing calendar or something like that).

Is there any problem with field that i cant see?

Of course, you can use a field as well. If the page is almost empty, that might even make sense.

Thank you texnixe. Always a pleasure.

You could use the sortable field as a starting point. It gives you the basics you would need for managing subpages in the content area.

Perhaps modifiy the uid method to fit your needs. And then prevent the user from changing the uid in the event with a proper permission.

This might be good idea. Since i am actualy using your field on the site.

But since the update (i used the older field before rewrite) i get thes errors

array_filter() expects at most 2 parameters, 3 given

which i cant seem to debug so i rolled back.

It has become quite more challenging to figure out the plugin although you got lot of docs it is becoming complicated. Suprisingly since the version before worked instantly.

Could you please send me a copy or a stripped copy of your project which produces this error? I know this problem but was not able to debug/fix it because I could not reproduce this error.

Also what php version are you using?

You are completely right. My mistake

I never realized i use ancient php version 5.5.38 on my desktop(never bothered to update osxs bundled php). It works just fine on server runing 7.10 and even gives some error messages.

Since most of the syntax changes came in 5.6 i switched to 5.6 and indeed the plugin is 5.6+ could you put it to readme requirements? I think when people see it they atleast check if thats not their problem. I would be wasting time with going over and over through docs without realizing this.

Such a stupid obvious mistake. Thanks awesome plugin.

No problem. I will add this to the docs.

I made quick example how to utilize the sortable field.
Just put it into site/plugins/sortable-events and you can use the events field in your blueprints.

This is awesome. Thanks! Should i pay you? :smiley:

Yeah I wil send you the bill soon :stuck_out_tongue_winking_eye:

No I am glad that I could help. Please let me know if you have any problems getting into the plugins code. The documentation is not perfect at the moment but I appreciate suggestions on what should be added or changed in the docs to make it more understandable.

What is correct?



To install the plugin, please put it in the site/plugins directory.
The plugin folder must be named events.

in your file

Its the same. Put the repo into plugins folder.

If you git clone it then give it right name sortable-events (same as the first php file of the plugin, this is kirby convention sortable-events.php in this case).
Also you need to have sortable plugin installed aswell this one just extends it.

And also dont expect it do do much, it was just blank start @lukaskleinschmidt was kind to provide for me (showing how to extend sortable field).

1 Like

It should be sortable-events. Fixed it in the readme.

And this one. It is just a boilerplate to get you started.

1 Like