Kirbytext error in textareas in structures

I’m making the first website with Kirby and have the following difficulty:
If I enter a text in the panel within a textarea of a structure, I have to specify HTML tags to customize the text. If I for example try to set text bold with the editor, then the two asterisks appear before and after, but the asterisks are then also displayed on the page and no fat text. The kirbytext works fine in other textareas outside of structures. What can be the reason?

it sounds like maybe you’re calling kirbytext() on the structure and not on the individual elements?

If you share your code, it might be easier to say. I know this works, as I do this all the time.

No, I didn’t call kirbytext on anything and that was the problem. :slight_smile:
Thank you, you helped me a lot.

For all the other kirby-rookies out there who got the same problem:
Instead of
<?= $mitarbeiter1['text1'] ?>
you have to use
<?php echo kirbytext($mitarbeiter1['text1']) ?>
to display kirbytext from structures.

Or use the toSstructure() method, it allows you to use arrow syntax and has other advantages (gives you a collection. to work with instead of an array):

$mitarbeiters = $page->yourStructureFieldNameHere()->toStructure();
foreach($mitarbeiters as $mitarbeiter) {
  echo $mitarbeiter->text1()->kirbytext();

Ditto the use of toStructure. Allows you to iterate nicely through the values as well.

Just a note for other kirby newbies… If you use $field()->kirbytext(), remember that you’re being returned a field object with a modified value, not a string. You’ll get a string if you try to print it, but that’s only through the magic of the __toString() function.

If you want to make sure you’re passing a string and not an object, just use field()->kirbytext()->value().

This took me some time to get my head around. Same story with the html() method.

(The reason for this is to support the chaining. Returning an field object means you can keep on trucking down the road.