Hello,
Forgive my beginner PHP knowledge, but I can’t seem to find an article specifically for this problem. In the blueprint file for a project, I have included a user selectbox:
author:
label: Author
type: user
This gives me the following:
All user have profile images and I want to return them as seen in this mock up:
I know from this link, https://getkirby.com/docs/cheatsheet/user/avatar I call a users avatar, but you need to know the username, in the case ‘bastian’:
<?php if($avatar = $site->user('bastian')->avatar()): ?>
<img src="<?php echo $avatar->url() ?>" alt="Bastian's avatar">
<?php endif ?>
I know I can call the username with the following:
<?= $project->author()->html() ?>
But when I mix the two together I get an error. Can anyone help?
Also, you can see from the screenshot above I’ve used multiple select boxes, for example in the “Division” and “Client” categories. Say I have the following in the parameters file:
client:
label: Client
type: select
options:
ben: Ben Sherman
ted: Ted Baker
And I use the same call:
<?= $project->client()->html() ?>
this would return “ben” or “ted”. Not “Ben Sherman” or “Ted Baker”, which is what i want.
What would I need to use to call the value rather than the option?
Thanks in advance for the help, Rob