I have the following structure:
|-HolderPage
|---Page 1
|---Page 2
where Page 1 & 2 are children of the HolderPage. In my case, my Pages have a "has_many" relation to ImageResources (Images with Title and Caption). Now I'd like to automatically generate a list of the children within my HolderPage (that works really well) and add one (the first) of the ImageResources as a thumbnail to the list-entries on my HolderPage. I tried
function getOneHiglightImage() {
return $this->HighlightImages("", "SortOrder ASC", null, 1);
}
within Page.php. For the template of the HolderPage I'm using:
function getChildren() {
return DataObject::get("Page", "ParentID = $this->ID", "Title ASC", "", "" );
}
and
<ul id="List">
<% control getChildren %>
<li>
<div class="Photo">
$getOneHiglightImage.HighlightAttachment
</div>
<div class="Title">
<% control Type %>
<a href="$Link" title="$Title">$Title</a>
<% end_control %>
<a href="$Link" title="$Title">"$Title"</a></div>
<div class="Summary">$Content.FirstParagraph</div>
<div class="ReadOn clearfix">
<a href="$Link" title="$Title"><% _t('READMORE','Read more') %> ...</a>
</div>
</li>
<% end_control %>
</ul>
HighlightAttachment is where the Image is stored. But that doesn't work for me. Can someone help me?