I need to make a sort of members section and need to display an image of each member.
I used the site blueprint and made tabs. One of them is the members of the board tab.
I can display names and phone numbers and stuff and everything, that is in the structure text fields, but not the images.
I either get no images at all or all images to every member.
This is my blueprint:
title: Site
options:
changeTitle: false
changeStatus: false
delete: false
changeSlug: false
flies: true
tabs:
# content tab
content:
label: Seiten
icon: text
layout: cards
width: 1
sections:
pages:
type: pages
headline: Seiten
layout: cards
vorstand:
label: Vorstand
icon: document
fields:
individuals:
label: Vorstände
type: structure
fields:
position:
label: Funktion
type: text
name:
label: Name
type: text
foto:
label: Foto
type: files
template: image
info: "{{ file.dimensions }}"
image:
ratio: 1/1
adress:
label: Adresse
type: textarea
phone:
label: Phone
type: tel
email:
label: Email
type: email
impressum:
label: Impressum
icon: cog
fields:
headlineImpressum:
label: Überschrfit
type: text
law:
label: Paragrafen
type: text
legalPerson:
label: Verantwortlicher
type: textarea
legalContact:
label: Kontakt
type: textarea
legal:
label: Impressum Text
type: textarea
other:
label: Was anderes
type: text
And this is the template code:
<div class="inner-content-large">
<h1><?= $page->title() ?></h1>
<div class="card-grid grid-container">
<?php $items = $site->individuals()->toStructure();foreach ($items as $item): ?>
<section class="card">
<h3><?= $item->position()->html() ?></h3>
<p><?= $item->name()->html() ?></p>
<?php $files = $site->individuals()->foto()->toStructure();foreach ($files as $file): ?>
<figure>
<a href="<?= $file->url() ?>">
<img src="<?= $file->url() ?>">
</a>
</figure>
<?php endforeach ?>
<section class="kontakt-section">
<?= $item->adress()->kt() ?>
<p><?= $item->phone()->html() ?> </p>
<a class="mailto-link" href="mailto:"><?= $item->email()->html() ?> </a>
</section>
</section>
<?php endforeach ?>
</div>
</div>
No matter if I use image
or files
.
I also guess that the path to the structure field is wrong, but that is what would makle sense to me.