How to implement KirbyTags in a textarea?

Sorry, me again.
How can I implement a KirbyTag in a textarea?
When, for example, I just add the following to a textarea, then it outputs these exact chars again:

(date: year)

Whole example (maintext is type textarea):

Title: Wohnungen


Introtext: Die xy Wohnungen


Maintext: We are living in (date: year)


Can’t find any hint in the documentation.

What do I do wrong?

Kind regards

Hello, @Alain!

Kirby stores the text in the content file exactly as you enter it in your textarea - so what you’re seeing is correct. Try, for example, to enter a (link: ...) or (file:...) kirbytag in your textarea, and you will see it in your content file, too. This is because kirbytags are meant to be placeholders for dynamic content - i.e., content that gets updated every time the page loads on the browser. That’s the difference, for example, between typing a date as text directly, or using the (date:...) kirbytag: the text date will always stay the same, but the date generated by the kirbytag will/may change every time the page loads, as it gets rendered by php.

To display the rendered ‘result’ of the kirbytag in your web page, you must use the kirbytext() helper or field method - or its short form, kt()- in your template.

So, if your textarea field is called, for example, “myfield”, right now you might be displaying its contents in your template like this:

    <?= $page->myfield() ?>

What you need to do is to use the kirbytext() - or kt() - field method, like this:

    <?= $page->myfield()->kt() ?>

There are other field methods you can use to render the content of the textarea in your templates. To see the full range, have a look at the textarea docs.

Ahaa :slight_smile:
Thanks for that hint.

This was the missing part in the KirbyTag Article in the documentation:

Such a concrete example would help and save sooooo mutch time to understand the documentation if you are not PHP- and Kirbyexpert :wink: