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?
Community guidelines
Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.
Solved by Ron Wardenier View solution
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();
$html->loadHtmlFile('https://www.your-forum.com/page_B');
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.
Log in to reply.
Suggested topics
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 2 | 95 | 14 hours ago | ||
| 1 | 61 | 19 hours ago | ||
| 0 | 47 | 1 day ago | ||
| 6 | 356 | 5 days ago | ||
| 3 | 44 | 6 days ago |