Hi @ all,
I'm trying to create my own image gallery. The galleries preview at the holder, should contain the last 4 images of this gallery.
The way i tried it doesn't work. I hope someone could help me.
The relations between the single pages and objects
GalleryHolder.php -> GalleryPage.php -> GalleryImagesObject.php -> Image Image Image ...
The GalleryHolder.php has this two function to sort the galleries and to get the latest 4 images of each gallery
public function getGalleries() {
return DataObject::get('GalleryPage', "ParentID = '$this->ID'", 'Date DESC');
}
function LatestGalleryImages($num=4) {
$galleryimage = DataObject::get_one("GalleryHolder");
return ($galleryimage) ? DataObject::get("GalleryPage", "ParentID = $galleryimage->ID", "Date DESC", "", $num) : false;
}
that's the GalleryImagesObject.php
<?php
class GalleryImagesObject extends DataObject {
public static $db = array(
'Title' => 'Text',
'Description' => 'Text'
);
public static $has_one = array(
'GalleryImage' => 'Image',
'GalleryPage' => 'GalleryPage'
);
public function getCMSFields_forPopup() {
return new FieldSet(
new TextField('Title', 'Titel des Bildes'),
new TextAreaField('Description', 'Beschreibung des Bildes'),
new ImageField('GalleryImage', 'Bild(er) hochladen')
);
}
}
?>
and my GallerHolder.ss looks like this.
<% control getGalleries %>
<% control GalleryImagesObject %>
$GalleryImage
<% end_control %>
<a href="$Link" title="Die Gallerie $Title anzeigen">$Title</a>
<% end_control %>
-----
Where's the mistake(s) i made? I can see the link but not the images :(
Thx for your Help
Benni
P.s. Website