i cant test it right now, but texnixe posted the following code a while back: It looks quite similar to what you are trying to archive. Btw. i am becoming hungry, menu looks very tasty
<table>
<?php foreach($page->training()->toStructure() as $item): ?>
<?php $count = count($item) ?>
<tr>
<?php foreach($item as $key => $detail): ?>
<td><?= $detail ?></td>
<?php endforeach ?>
</tr>
<?php endforeach ?>
</table>
Don’t know if I get you right, but how about a nested foreach loop, something like this:
<table>
<?php foreach($page->training()->toStructure() as $item): ?>
<?php $count = count($item) ?>
<tr>
<?php foreach($item as $key => $detail): ?>
<td><?= $detail ?></td>
<?php endforeach ?>
</tr>
<?php endforeach ?>
</table>
Unfortunately the documentation is limited to not nested yaml / structured field, since nesting structured fields in the panel is not possible:
…
sections:
label: Sections
type: structure
fields:
text:
label: Text 1
type: text
subsections:
label: Subsections
type: structure
fields:
text:
label: Text 2
type: text
…
I’m having an error in : The field could not be found in …/panel/app/controllers/views/editor.php on Line 60.
https://getkirby.com/docs/cookbook/structured-field-content
1 Like