I am trying to call a PHP file from a form button. I put the file to be called into the asset folder of the Kirby site and calling it works well so far. However, I don’t seem to be able to call any Kirby functions from that PHP file like $kirby->url() or $kirby->option(‘someOtherSetting’);
Can Kirby functions only be used by files in the site folder? If so, can I put my PHP to be called in there as well? So far whenever I have tried that I get a server error.
I am having a bit of trouble wrapping my head around how that would work.
So my button is calling a route and the route then executes my script? (My PHP essentially calls a Python script via exec() and passes along the form input.)
So I can write my PHP in a route? Or would the route call my PHP script? And how do I pass along my form fields?
Actually, I didn‘t say Panel. The button lives on the homepage.
Ok, here is the full description of what I want to do. I have a form field that takes a URL and a button that submits that URL. I also have a Python script that runs stuff based on that URL. I‘d like to connect that button with the Python script.
I do have a rudimentary version working by calling a PHP script that lives in /assets/php/takes_form_input.php. The PHP then calls my Python script that lives in /assets/python/does_stuff.py. But right now all the paths are hardcoded in the takes_form_input.php and I‘d like to use the dynamic paths Kirby gives me.
At least it would be nice to have. As I said, it is working right now, but hardcoded paths are not ideal.