Hi,
I want to show my fields only if the content is not empty. This works so far with:
<?php if (!$page->textdetails()->empty()): ?>
<div class="details">
<?php echo $page->textdetails()->kirbytext() ?>
</div>
<?php endif ?>
But how do I get it to work in this case:
Template:
<div class="address">
<?php echo $address['name'] ?><br />
<?php echo $address['job'] ?><br />
<?php echo $address['phone'] ?><br />
</div>
Blueprint:
contact:
label: Contact
type: structure
entry: >
{{name}}<br />
{{job}}<br />
{{phone}}
fields:
name:
label: Name
type: text
job:
label: Job
type: text
phone:
label: Phone
type: text
I don´t know: Can the br tag be a problem?
When a field is not filled - the “br” breaks the line and leaves an empty line.
Does anyone have a solution?
Dan