Calculated information in the backend

Hello!

I’m building a page in which I want to display dynamic data in the backend.

The price of every image could, for instance, be calculated as Width * Height – how would I do that in the panel, and how could I then show it in such a nice box? (That’s not an Info field, is it?)

Thank you!

No, that’s a stats section: Stats section | Kirby CMS

You can use template strings in combination with a page model method that does the calculation:

Wow, thank you very much!

It worked :slight_smile:

Side note:

One thing that I noticed when copy+pasting from the docs page

was that the example code for the shop.php model file doesn’t contain the PHP opening

<?

line – for quick copy+pasters like me, it might be helpful to put it there (especially as that file doesn’t necessarily throw a particularly visible error message)?

Anyway, thank you so much and all the best!

Yes, you are right, but if you use an IDE that creates PHP files with the opening PHP tag already included (should be <?php not the short <? tag), it can be just as annoying to have to remove it;)

True! :slight_smile: Again, thank you for your help, and all the best!