Hello all!
I have a blueprint with 3 URL fields and would like that when I type no website so I leave the URL box empty,
when I open my page will show nothing.
While now If I leave the URL box empty it will link to my homepage and that I don’t want.
Is there a way to change it?
Thanks,
greetings,
Arianna
texnixe
November 13, 2019, 11:17pm
2
Please post your template code. You probably need an if statement that checks if the field is empty and only renders the link if not
Ah what kind of if statement could it be?
Here is my template code:
<table>
<?php foreach($page->project_file_eng()->toStructure() as $member): ?>
<td><?= $member->reference() ?>
<?= html::a($member->r_url1()) ?></td>
<?php endforeach;?>
</table>
and my blueprint:
columns:
- width: 1/2
fields:
title_eng:
project_file_eng:
type: structure
fields:
reference:
label: reference
type: textarea
r_url1:
label: URL_reference
type: url
width: 1/2
texnixe
November 14, 2019, 7:55am
4
<table>
<?php foreach($page->project_file_eng()->toStructure() as $member): ?>
<td><?= $member->reference() ?>
<?php if ($member->r_url1()->isNotEmpty()) : ?>
<?= html::a($member->r_url1()) ?>
<?php endif ?>
</td>
<?php endforeach;?>
</table>
texnixe:
<?php foreach($page->project_file_eng()->toStructure() as $member): ?> <?php endforeach;?> <?= $member->reference() ?> <?php if ($member->r_url1()->isNotEmpty()) : ?> <?= html::a($member->r_url1()) ?> <?php endif ?>
thanks! It works perfectly!