Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

has_many Images


Go to End


4 Posts   3252 Views

Avatar
xmedeko

Community Member, 94 Posts

21 June 2007 at 3:39pm

Hi,

I have a Slideshow, which has many Images. (Particularly, Slideshow has_many SlideshowImage, and SlideshowImage has_one Image). The ImageField does not work with has_many relationship. What is the best way to have some has_many image chooser for CMS?

Thanks very much
Andy

Avatar
Nathan Cox

Community Member, 99 Posts

21 June 2007 at 4:27pm

Maybe I'm misunderstanding, but why do you need has_many images? Wouldn't you make a lot of SlideshowImage objects and give each one a single image?

The Slideshow would then have a relationship to each SlideshowImage, but not directly to any actual images..

Avatar
xmedeko

Community Member, 94 Posts

21 June 2007 at 6:12pm

The SlideshowImage has 'Sort' field, holding an information about the order of images in the slideshow. So, the link from Slideshow to Image is indirect through SlideshowImage.

I got it working, if I fill values in MySQL manually :-) My main problem is to make some nice multiple image chooser in the CMS.

Avatar
Sam

Administrator, 690 Posts

21 June 2007 at 10:41pm

Currently no such form control exists, unfortunately. You'd need to create a class similar to ImageField yourself. If you manage to get this sort us, let us know how you get on.