Hi everyone,
For a client website I really need to use the table-field plugin developed by ragi96.
However, even if I’m trying really hard, I always get an error.
I downloaded the plugin and put it in the site/plugins folder, named table-field as recomended.
As I need my client to have the possibility to add one or more tables, I put the tag table in a structure.
My blueprint looks like this:
title: Impianti
status:
draft: true
unlisted: false
listed: true
columns:
left:
width: 2/3
sections:
content:
type: fields
fields:
systems:
label: Lista degli impianti
type: structure
columns:
title:
width: 3/4
active:
width: 1/4
fields:
title:
label: Nome
type: text
systemDesc:
label: Descrizione
type: markdown
size: medium
systemSpec:
label: Lista dei dati tecnici
type: structure
fields:
title:
label: Titoletto
type: text
techData:
label: Dati tecnici
type: markdown
size: medium
table:
label: Test tabella no. 1
type: table
options:
maxColumns: 3
gallery:
label: Galleria di immagini
type: files
multiple: true
layout: cards
image:
ratio: 1/1
cover: true
uploads: image
active:
label: Impianto è attivo?
type: toggle
default: true
right:
width: 1/3
sections:
images:
headline: Immagini e schemi
type: files
template: image
My template looks like this:
<?php snippet('header', ['submenu' => true, 'sections' => $page->systems()->toStructure()]) ?>
<!-- Sezione IMPIANTI
================================================ -->
<?php if($page->systems()->isNotEmpty()): ?>
<?php foreach($page->systems()->toStructure() as $system): ?>
<section>
<div class="system">
<span id="<?php echo $system->title() ?>" class="anchor"></span>
<h2 class="h1"><?php echo $system->title()->html() ?></h2>
<h2><?php echo $system->subName()->html() ?></h2>
<?php echo $system->systemDesc()->kt() ?>
<?php if($system->systemSpec()->isNotEmpty()): ?>
<?php foreach($system->systemSpec()->toStructure() as $techData): ?>
<strong><?php echo $techData->title()->html() ?></strong>
<?php $table = $techData->table()->toTable() ?>
<?php foreach($table as $tableRow): ?>
<?php foreach($tableRow as $tableCell): ?>
<td><?php echo $tableCell ?></td>
<?php endforeach ?>
<?php endforeach ?>
<?php endforeach ?>
<?php endif ?>
<?php snippet('gallery', ['collection' => $system->gallery()->toFiles()->sortBy('sort', 'asc'), 'fancyGroup' => $system->title()->html()]) ?>
</div>
</section>
<?php endforeach ?>
<?php endif ?>
<?php snippet('footer') ?>
Whatever I try to do I get the error
Invalid argument supplied for foreach()
and I really don’t understand why.
I’m also getting tired to try and I probably better stop and ask rather than keeping wasting time.
Thanks to anyone who can help me out!
Sara


