Hi there
Alright, I am having trouble getting structured content to work despite having read some articles about the matter. Maybe you folks can lend me a tought and a code.
What I want to do
A simple way for editors to manage / edit related articles by panel usage. In front end, the outputted list is an horizontal image slider with the items created via the panel. The slider-list is made up of the first image from each related article and an accompanying headline; See below.
Current approach that works fine but is bad for editors
At the moment I am using a simple text input field for creating a list with urls of the articles that should be related to one another. However this is too difficult for the editor to always manually write down such a list:
Panel
- blog/lorem-ipsum
- blog/dolor-sit-amet
- blog/nunc-consecitur
Blueprint
related:
label: Related articles
type: textarea
buttons: false
Snippet
<ul>
<? $n=0; foreach($page->related()->pages() as $r): $n++; ?>
<? if($r->images() != ''): ?>
<li>
<a href="<?= $r->url() ?>" class="item<? if($n==1) echo ' active' ?>" title="<?= $r->title()->html() ?>">
<h4><?= $r->title()->html() ?></h4>
<? $image = $r->images()->first() ?>
<img src="<?= thumb($image, array('width' => 174, 'height' => 150, 'crop' => true), false) ?>" />
</a>
</li>
<? endif ?>
<? endforeach ?>
</ul>
How I want it to be editable
I would like to change the usability in the panel to have Structured Field Content do the magic. But I can’t get the image thing in my markup (See above) to work with the panel output ![]()
Blueprint
related:
label: Related articles
type: structure
entry: >
{{relatedarticle}}
fields:
relatedarticle:
label: Article
type: select
options: siblings
I hope you get what I mean or am trying to do
I need to get the structure type thing to be included in my snippet, but can’t get it to work because of the image thing…
