First, create a parent page, e.g.
reviews in the
/content folder and inside it, a
reviews.txt text file.
This page will serve as our model for child pages.
Reviews page model, we redefine the
children() method to get the subpages from the API instead of from the file system:
api-key with the API key you got for your app.
Unless you have disabled UUIDs in your config, you have to pass a
uuid field in the content array to prevent Kirby from generating the page in the file system when the
$page->uuid() method is called.
If you generate the UUIDs automatically like in the example above, they will change at every load. However, if you want to reference your virtual pages anywhere with their UUID, make sure to use a unique string that does not change.
Remote::get() method, you connect to the API and fetch the results. Within the foreach loop, you feed the results into the
$pages array and finally pass it all to the
The pages are now accessible in the template and you can loop through them like through a normal set of Kirby pages, using the fields defined in the
For the children themselves, you can create their own
review.php template to access more details:
The result could then look something like this: