Hi all.
I have a multilang setup and want to build virtual pages from a .json
source (which is coming from another Kirby installation). I am using a page model to set everything up.
I got quite far and the virtual pages are actually displayed in the panel on the parent page. However, when I try to enter one of the pages, I get a 404 β Not found
error. What am I doing wrong?
Here is my model:
<?php
class KvdatesPage extends Page
{
public function children()
{
$site = kirby()->site();
$pages = [];
$request = Remote::get($site->getKgb(false, 'kv', 'url') . '/termine.json');
$events = json_decode($request->content());
foreach ($events as $event) {
$translations = [];
foreach ($event->translations as $translation) {
$translations[$translation->code] = [
'slug' => $translation->slug,
'code' => $translation->code,
'content' => [
'title' => $translation->title,
'num' => $translation->num,
'duration' => $translation->duration,
'startDate' => $translation->startDate,
'location' => $translation->location,
'banner' => $translation->banner
]
];
}
$pages[] = [
'slug' => $translations['de']['slug'],
'template' => 'event',
'model' => 'event',
'translations' => $translations
];
}
return Pages::factory($pages);
}
}