Hi zonky,
besten Dank für deine Antwort.
Wenn ich das [0] hinzufüge, bekomme ich keine <th> mehr ausgegeben.
PHP-Code:
<?php foreach ($this->data[0] as $arrItem): ?>
<?php foreach ($arrItem['attributes'] as $field => $strName): ?>
<?php if ((isset($arrItem[$this->getFormat()][$field]) && ($strValue = $arrItem[$this->getFormat()][$field])
|| (isset($arrItem['text'][$field]) && ($strValue = $arrItem['text'][$field])))): ?>
<th class="item <?= $arrItem['class'] ?>" scope="col"><?= sprintf($GLOBALS['TL_LANG']['MSC']['field_label'], $strName) ?></th>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach($arrItem['actions'] as $action): ?>
<th>
<span>Aktion</span>
</th>
<?php endforeach; ?>
<?php endforeach; ?>
Wenn ich das foreach wegnehme, bekomme ich einen Contao-Fehler ausgeworfen:
PHP-Code:
<thead>
<tr>
<?php ($this->data as $arrItem): ?>
<?php foreach ($arrItem['attributes'] as $field => $strName): ?>
<?php if ((isset($arrItem[$this->getFormat()][$field]) && ($strValue = $arrItem[$this->getFormat()][$field])
|| (isset($arrItem['text'][$field]) && ($strValue = $arrItem['text'][$field])))): ?>
<th class="item <?= $arrItem['class'] ?>" scope="col"><?= sprintf($GLOBALS['TL_LANG']['MSC']['field_label'], $strName) ?></th>
<?php endif; ?>
<?php endforeach; ?>
<?php foreach($arrItem['actions'] as $action): ?>
<th>
<span>Aktion</span>
</th>
<?php endforeach; ?>
</tr>
</thead>
Mache ich die Anpassungen falsch?
Grüße
Alexander
Lesezeichen