Hello,
iam trying to store a images link with structure. So first the problem is i made a structure with 4 Fields:
but i can´t edit the image field… why?
Second problem is the linking to the Image i store in my template. I tried:
<?php foreach($faces_list as $judge):?>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 pad_top">
<div class="face-box">
<div class="face-img">
if($judge->image() = $page->image()->url())
<img src="<?= $page->image()->url() ?>">
</div>
<div class="face-text">
<h3><?php echo $judge->name()?></h3><p><?php echo $judge->text()?></p></br>
<a class="conect_link" href="<?php echo $judge->link()?>">contect</a>
</div>
</div>
</div>
<?php endforeach ?>
First of all: What is stored in `$faces_list?
What do you mean by "can’t edit the image field? What does your blueprint look like?
I stored my Structure:
$faces_list = $page->faces()->toStructure();
Blueprint:
Faces:
it always shows just 3 Fields when i wanna edit it in the panel
here are just 3 Fields, but the picture field is missing
This the Blueprint:
faces:
label: Faces
type: structure
entry: >
{{name}}<br />{{text}}<br />{{link}}<br />{{picture}}
fields:
name:
label: Name
type: text
text:
label: text
type: text
link:
label: link
type: text
picture:
label: picture
type: text
texnixe
January 24, 2017, 10:08pm
6
Your if statement does not make sense.
<?php foreach($faces_list as $judge):?>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 pad_top">
<div class="face-box">
<?php if($image = $judge->picture()->toFile()): ?>
<div class="face-img">
<img src="<?= $image->url() ?>">
</div>
<?php endif ?>
<div class="face-text">
<h3><?php echo $judge->name()?></h3><p><?php echo $judge->text()?></p></br>
<a class="conect_link" href="<?php echo $judge->link()?>">contect</a>
</div>
</div>
</div>
<?php endforeach ?>
texnixe
January 24, 2017, 10:12pm
7
Hm, I cannot reproduce this, although it seems that when I copy/paste your blueprint, there is a tab instead of whitespace in the picture indentation.
Now it shows all the fields…yes! It was a Tap or something.
Page Error with the script:
<?php if($image = $judge->picture()->toFile()): ?>
it works now! I forget to close the if statement …Thank you very much