I’m pretty new to kirby and im googeling and searching for days and can’t find snippets or examples or anything.
I want to display the Authors Name and Avatar Image in my template but all i get is the E-Mail adress with an - in front, like “- email@example.com”
<?= $page->author()- ?>
<?= $page->author()->id() ?>
<?= $page->author()->name() ?>
all the same result.
As far as i understand kirby in the txt file is just that information field. So how is it possible to search the $user with my $author - email adress ?
Is there something like a real beginners guide ?
Hey @Arnold, welcome to Kirby and the community.
You have to convert your field value to a user object (https://getkirby.com/docs/reference/panel/fields/users#how-to-use-in-templates-snippets):
<?php if ($author = $page->author()->toUser()): ?>
<?php echo $author->name() ?>
<?php endif ?>
All fields that are not quite straightforward have a little section how to render them in a template.
Before you get really frustrated because you can’t find an answer in the docs, ask us here. We are usually quite fast with providing an answer.
Our documentation has three parts:
Guide: a general introduction into the most basic concepts with links to more in details stuff in the reference, intended for beginners
Reference: in-depth documentation of every class/method/fields/extensions etc.
Cookbook: Recipes for everyday use cases (and some not so everyday ones)
thx very much for such a fast reaction, thats solving one of my problems and i guess i’m able to gp on now and solve my other questions with that hint