Any help, I cannot seem to understand where I went wrong, or what I need to do:
<?= $service->content() ?> doesnt seem to work
<?php foreach ($page->myServices()->toStructure() as $service): ?>
<h3><?= $service->title() ?></h3>
<?= $service->content() ?>
<?php endforeach ?>
I get this error:
Whoops \ Exception \ ErrorException (E_RECOVERABLE_ERROR)
Object of class Kirby\Cms\Content could not be converted to string
Could you post your blueprint (or the part relating to the structure field) please?
Sorry, yes here it is:
# Services Section
label: Services Section
label: My Services
<?= $service->content()->get('content')->kt() ?>
Brilliant, it works!
Just to further my knowledge, may I ask why i need ->get()?
How come it doesnt work without like the h3 title? Thanks!
In general, it is recommended to use field names other than Kirby native methods. If you use them nevertheless, you have to go via the
content() object. See docs: Fields | Kirby CMS
Makes sense, thank you very much!