Hello all,
I am kind of new to Kirby & PHP & Development in general.
I hope I’ll manage to formulate my question clearly as I got a little stuck here.
I am trying to call images from a structure field.
The structure field is on the children’s pages of my home.
My code looks like that:
<?php
$slides = $page->gallery()->toStructure();
?>
<div class="swiper__container">
<div class="swiper__wrapper">
<?php foreach ($slides as $slide):
$src = $slide->image()->toFiles();
?>
<div class="swiper__slide">
<img src="<?= $src ?>">
</div>
<?php endforeach ?>
</div>
Which results in seeing broken image icons on my page and these having a wrong path.
Opening the image in a new tab also shows a strange double “home”:
localhost/myproject/home/home/subpage-name/image.jpg
I tried troubleshooting via some other similar problems I have found in other – already solved – topics with no success! I am quite aware must be a problem of “addressing” the right path in my PHP but I am somehow still failing!
Thank you for your support!