tutchi
March 19, 2016, 4:47pm
1
This is my field settings for partners page.
I would like to put in my template the tag for the src url:
Can someone help me?
<img class="partners" src="**?**" alt="<?php echo $partners->alt()->html() ?>">
partners:
label: Partners
type: structure
style: table
fields:
image:
label: Image
type: select
options: images
This should work
<?php
$partners = $page->partners()->toStructure();
foreach($partners as $partner): ?>
<img src="<?php echo $partner->image()->toFile()->url() ?>">
<?php endforeach ?>
Or do you want to fetch an individual partner only?
If the above does not work, you can also do this:
<?php
$partners = $page->partners()->toStructure();
foreach($partners as $partner): ?>
<img src="<?php echo $page->image($partner->image())->url() ?>">
<?php endforeach ?>
Edit: You might get into trouble with calling the field image, though, because the image()
method is reserved by Kirby, so pls. change it to something like myimage
or whatever.