PHP Plugin Question(s)

I am admittedly over my head, but I really would like to start using, and learning how to use, Grav more. I’ve been using Joomla from back in the Mambo days (before the split), but I’m having trouble grasping some parts of Grav, notably plugins.

What I’m trying to do is integrate a job posting script from PHPJabbers, and I can’t quite grasp the plugin process.

This is what I need to do (screen shot below)…

URL to web page where jobs listing is placed (define)

Step 1. Copy and paste following code at very top of your page, before any other code.

<?php ob_start(); ?>

Step 2. Copy and paste following code inside your html code, where the job listing will be displayed.


Step 2a (Optional). Copy and paste the code below inside the part of your page, where the meta tags will be printed.


Step 3. Copy and paste following code at very bottom of your page, after all the code.

<?php include '/home/pjabbers/public_html/153XXXXXXX_713/app/views/pjLayouts/pjActionLoad.php'; ?>

I’ve looked through the plugin recipes, downloaded sample plugins to get the concept, and read the docs… and I’m still lost.

Any nudges in the correct direction for a total n00b would be much appreciated.

Script integration screen shot…

The most important part of plugin coding that people seem to consistently miss is the Grav Lifecycle. That’s how you know what events are available and which you need to target.

The problem here is that this service requires modifying PHP, not HTML. To my knowledge (and I’m not an expert), there’s no way to do this using plugins. By the time plugins are called, Grav is already in complete control. The plugin can inject stuff in the final HTML, but it can’t retroactively change the Grav PHP code.

What you can do is write a plugin that fetches the job data from an external API and then populate that into your HTML in any number of ways. (See the IPLocate plugin for an example.)

But Grav is essentially a super-powered templating system designed to generate HTML, not PHP. It runs on PHP itself, but it doesn’t generate it.

Thanks for the reply. I really appreciate it! I think I’ll need to explore other options.