How to map URI to controller code?

I have a widget I’ve built to respond to particular URI: I had this working but have now forgotten what magic I used.

The widget has a link which looks like this:

This is intended to trigger the method: Installer::deploy( $which )

Currently this link results in a 404. My question is: Where should my installer.php file (containing the class) be placed so that th URL will be recognized?

As I said, I have had this working, but since then (about two months ago) I’ve messed up the Kirby installation and had to reinstall. Some change I have forgotten to make is missing.

Any help appreciated. TIA, Erik

So if I understand you:

  1. You have a widget in the Panel Dashboard that has a link in it
  2. When the user clicks the link you want to execute installer.php (which then does something relating to your plugin?)
  3. When you install and test the link returns a 404, instead of executing installer.php

I’m a designer, not a programmer, but I’d:

  1. make sure that installer.php is in /site/plugins directory and try re-writing your link to point to it, as maybe the router from panel dashboard assumes that’s the target?
  2. permissions set to something that will allow the web server or kirby to execute a script wherever you have it located?
  3. From my limited experience, I think Controllers are used to house logic for a specific page or template but plugins are for system or site wide services (you mentioned controller in your question)

My interest in this is somewhat self serving, as I’m loving Kirby a lot and like to build more sites with it, so I want to find out more about how plugins and the like are constructed.


Take a look at the Kirby router. You can create a route in your configuration that calls the method of the Installer class.