Hello,
I am trying to create a table on my page with a structured data field. Somehow it does not work.
I would like to have one little list above and then the table with all the data.
None of the data appears on my page.
Could somebody help me? I am used to working on Kirby V2 so those are my first tryouts with the new version!
Thanks a lot
The page is called note.php which is a template and here is the code:
<main>
<section>
<h2>try out</h2>
<div class="text">
<ul>
<?php foreach ($page->project_file_eng()->toStructure() as $member): ?>
<li><?= html::a($member->reference(), $member->title()) ?></li>
<?php endforeach ?>
</ul>
</div>
</section>
<!-- english table -->
<table class="blueTable">
<?php foreach($page->project_file_eng()->toStructure() as $member): ?>
<?= $member->definition() ?>
<tr>
<td >number</td><td><?= $member->e_number() ?></td></tr>
<tr>
<td >word</td><td><?= $member->word() ?></td></tr>
<tr>
<td >definition</td><td><?= $member->definition() ?></td></tr>
<tr>
<td >reference</td><td><?= $member->reference() ?></td></tr>
<tr>
<td >context</td><td><?= $member->context() ?></td></tr>
</tr>
<?php endforeach;?>
</table>
</main>
While my blueprint note.yml has the following structure:
title: Note
num: date
icon: 📖
status:
draft:
label: Draft
text: The note is still in draft mode. It can only be seen by editors with panel access.
unlisted:
label: In Review
text: The note is online and can be visited with the direct URL. The team must still give the final go to publish it.
listed:
label: Published
text: The note is online and listed in the blog
columns:
- width: 1/2
fields:
project_file_ita:
type: structure
fields:
titolo:
label: titolo/parola
type: text
e_number_ita:
label: e_number_ita
type: number
definizione:
label: definizione
type: textarea
referenza:
label: referenza
type: textarea
contesto:
label: contesto
type: textarea
- width: 1/2
fields:
project_file_eng:
type: structure
fields:
title:
label: title/word
type: text
e_number:
label: e_number
type: number
definition:
label: definition
type: textarea
reference:
label: reference
type: textarea
context:
label: context
type: textarea