Inserting a variable into text from a textarea

I’m a bit blocked right now and need a little hint. How would you solve the following problem:

In a template, I use text that comes from a textfield/textarea in the panel:

“In our zoo live animals from all continents”.

Now I want to extend the text.

"In our zoo live animals from all continents, a total of {numberOfSpecies} species.

Where {numberOfSpecies} is supposed to be a variable that is dynamically created by a controller. Is something like this possible in Kirby? I would not like to write all the text statically in the template.

Any hint is welcome!

TIA

Thomas

Yes

1 Like

Thank you very much, Sonja. I knew, that I read about placeholders some time ago, but was not able to find the guide.

One last question: Can I integrate the code for calculation of the placeholder content (some looping over children and grandchildren) into the page controller or do I have to place the code into a plugin?

Yes

No, but you could move it to some function or page method or into a Page model

Perfect! Will use a Page model. Thanks again!