I see.
Thanks a lot for your help
hi. thats my idea. i tried it and yes its doesnt work in a structure field.
but,β¦
is there another idea to do a better way that i add 8 image-fields with image1, image2 β¦
You could try the multi-select field or the selector field
Maybe the relationship field would be an option, too. Have never tested this in a structure field, though.
Edit: Theimages field works in a structure field as well. Probably the best option although dragging and dropping doesnβt work.
very nice. thank you.
thats it. i tried images field - it works.
now i have the case thats the structure is in a structure element.
<?php
$posters = $page->posters()->yaml();
foreach($posters as $poster): ?>
<h1><?php echo $poster['name'] ?>, <?php echo $poster['version'] ?></h1>
<figure>
<?php $images = $page->posters()->artwork()->yaml();
foreach($images as $image): ?>
<?php if($image = $page->image($image)): ?>
<?= $image->value(); ?>
<?php endif ?>
<?php endforeach; ?>
<figcaption>© <?php echo $poster['agency'] ?></figcaption>
</figure>
<?php endforeach ?>
how can i solve this? . i get an output but all the sctructure data, not only the images
thanks for help.
@dersven Could you please show me what your content file looks like now?
Since you have a nested yaml field, this line:
$images = $page->posters()->artwork()->yaml()
should rather be
$images = yaml($poster['artwork']);
or something like this. And Iβd rather use toStructure()
on the main structure, anyway.
<?php
$posters = $page->posters()->structure();
foreach($posters as $poster): ?>
<h1><?= $poster->name() ?>, <?= $poster->version() ?></h1>
<figure>
<?php $images = $poster->artwork()->structure();
foreach($images as $image): ?>
<?php if($image = $image->toFile()): ?>
<?= $image ?>
<?php endif ?>
<?php endforeach; ?>
<figcaption>© <?= $poster->agency() ?></figcaption>
</figure>
<?php endforeach ?>