hi,
i want to write ‘exercises’ into a json file and read it back later (for caching). they can contain several videos. i do so in my write json function:
foreach ($exercises as $exercise) {
$categoryData['exercises'][] = array(
'title' => $exercise->title(),
'editlink' => $exercise->panel()->url(),
'text' => $exercise->text()->kirbytext(),
'vids' => $exercise->videos()->filterBy("extension", "mp4"),
'dauer' => $exercise->dauer()
);
}
this ends up like this in json file
"vids":{"data":{"richard/categories/video1.mp4":{"content":null,"translations":null},"{"richard/categories/video2.mp4":{"content":null,"translations":null}}}
then i my template:
<?php foreach ($exercise['vids']['data'] as $videoUrl => $videoData) { ?>
<div class="video"> <video controls><source src="<?= $site->url() ?>/<?= $videoUrl ?>" type="video/mp4"></video></div>
<?php } ?>
the videos dont show up.
this is from the source code
video controls><source src="http://localhost/ueben/richard/categories/repertoire/video1.mp4" type="video/mp4"></video>
in contrast from previous version of my site using normal kirby objects the links are different and point to the media folder…
<video controls><source src="http://localhost/ueben/media/pages/richard/categories//a8f31ee611-1684178189/video2.mp4" type="video/mp4"></video>
these links work.
so i beg to ask how can i get the right video urls into my array to put into the json file?
tnx for any idea!
greetz,
fusi