Here’s the deal: I have a template with ajax forms, with the JS and the php processing page in assets folder.
Now I want to make some strings in the php dynamics, like the receiver mail. How did I do that ? I read this topic but this solution throw me an error 500 and I’ve not the skill to figure out why.
I’ve tried to check the toolkit doc but it’s only a cheat sheet so I don’t know where to start, or even the great principles of the toolkit.
Other related question : the JS file calls some assets (like spinner images) and I don’t know how to link correct asset (as the relative link throw me an 404).
last question why we can’t access snippets folder the same way we can access assets folder ?
<?php echo kirby()->urls()->assets() ?>
Do putting the php file in snippets can be a solution ?
Take a look at routing. Instead of storing your PHP files in the assets folder, add the logic to a route and process the request inside it. A route has access to all Kirby objects by default.
Thank you I will look forward, but I’m afraid that it’s way above my skills. I’m just a designer after all
I’ll add a quick remark on documentation: you never really know the “why”, the purpose of the function, the big picture. It’s hard for a newbie to figure out why the function exists. Like route, I can read the doc and the examples but I’ve no idea where I have to start, where I put the files, why and so on…
Thanks for your feedback. Could you give an example of such a function with some explanation what sort of information you would expect?
My english is too bad to explain it, but in short, in the route example, just an intro text with “a route is this and that, and it’s useful if you try to di this and that with short examples”