toStructure delivers no data

The blueprint should be fine, I get no error in the panel. The txt file Looks also fine. If I print_r the array I get all the data

<?= print_r($page->content()) ?>

After toStructue <?= print_r($page->content()->toStructure()) ?>
I get this:

Kirby\Cms\Field Object ( [tostructure] => ) 1

That doesn’t mean anything, it’s just that the debug output for the structure field is not really enlightening.

If you want something more meaningful, you can use toArray()

<?= dump($page->content()->toStructure()->toArray()) ?>
1 Like

If I try to access the data

<?php foreach($page->content()->toStructure() as $c): ?>
<?= $c->hd() ?>
<?php endforeach ?>

happens Nothing… no Error no Text

This is the result
[tostructure] =>

Ah, ok, that’s because content() is a native Kirby method. You either have to rename the field or use

<?php foreach($page->content()->content()->toStructure() as $c): ?>

1 Like

:sweat_smile: Thank you very much… I actually had this idea and tried contento for quck testing… I thik I forget to rewrite the txt file