Hi,
I need a structured field for employees!
Photo, employee name, job title and phone.
It works so far - I can even select between different images - but how can I echo the url of the image from the selected field in my template?
Thanks for help!
Dan
My template
<?php $addresses = yaml($page->contact()) ?>
<?php foreach($addresses as $address): ?>
<div class="employee-photo">
/* place image here - this does not work: */
<?php if($photo = $page->image($page->photo())) :?>
<img src="<?php echo $photo->url() ?>" />
<?php endif ?>
</div>
<div class="address">
<?php echo $address['name'] ?><br />
<?php echo $address['job'] ?><br />
<?php echo $address['phone'] ?>
</div>
<?php endforeach ?>
My blueprint:
title: Pure
pages: true
files: true
fields:
title:
label: Titel
type: text
subtitle:
label: Subtitel
type: text
text:
label: Text
type: textarea
contact:
label: Contact
type: structure
entry: >
{{photo}}<br />
{{name}}<br />
{{job}}<br />
{{phone}}
fields:
photo:
label: Photo
type: select
options: images
name:
label: Name
type: text
job:
label: Job
type: text
phone:
label: Phone
type: text