i created a simple php script which reads a json file.
I searched now for a way to implement my code in a grav page (quark-theme used).
If i read it correctly its not possible to run own php code for security reasons - instead i should create a own plugin.
is it really necessary to write an own plugin to display a simple php-script?
isn’t there an easier way to include the php-script and (if possible) to include it with a shortcode-variable in the sidebar?
Only extensions can run PHP; you’ll need to bootstrap the script for a theme or plugin. With the DevTools-plugin and CLI, it takes less than 30 seconds to create one. The default plugin-template creates a variable sent to Twig, you can change that to load your JSON, so you can iterate over it.
@OleVik, Correct me if I’m wrong, but I’m afraid the functionality of a plugin created by the ‘devtools’ plugin does not provide the functionality as you describe.
@keks, Would you mind sharing your relevant coding skills (e.g. php, twig, cms)? That will allow the community to adjust the answer to your level of coding experience.
Also, would you mind sharing what you have got and done so far?
To show what you have created, you could run the OS command $ tree | clip (Windows) or $ tree | clip.exe (Linux) inside your plugin folder and paste it in your answer between two lines containing triple back-ticks (```).
In regards to the quickest way to “display a simple php-script”, using the DevTools-template is pretty quick. If the sidebar is rendered with Twig, which is almost certain, handling the JSON that way is likely easier than creating a shortcode.
As pamtbaau writes though, it’ll be easier to write a pertinent answer if you share your experience-level. Shortcodes aren’t hard to create, but they require more handling than just manipulating data in PHP, then passing and rendering it in Twig.