Pass data from one page to another

Sorry, I’m new to grav.
I have a page (page_A) which should make a php request to a forum page (page_B) with posts. page_B is not part of grav, but is an external page
page_A must take the title, date, and author of posts from page_B and print them on the screen, but must print only the last 3 posts inserted in the forum of page_B.
Does anyone help me understand how to deal with grav?

Hello @lucapu88, welcome to the Grav Forum.

Assuming the forum with page_B does not have an API there is only one way to pull content into Grav and that’s by ‘web scraping’.

One approach could be to create a plugin and use the DiDOM HTML Parser library. With that it is easy to get the full HTML of page_B with:

$html = new Document();

Once you have the HTML you can manipulate it anyway you want.

To get started I suggest you read the Plugin Tutorial in the Grav Learn site and study the Page Inject Plugin and the Image Captions Plugin. The latter uses the HTML parser I pointed to.

1 Like