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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

DataObjectManager : <% sprintf(....) %> displayed on the website

Go to End

48 Posts   10781 Views


Forum Moderator, 4102 Posts

23 February 2010 at 5:44pm



and you can remove requirements in the init() function of your subclass



Community Member, 178 Posts

23 February 2010 at 5:46pm

Sweet.... THANK_YOU


Community Member, 178 Posts

26 February 2010 at 8:22am

Edited: 26/02/2010 8:23am

I have this working rather nicely right now (from my humble point of view)
I have created a subclass of SlideshowProPage called SlideshowPage
taken out a couple unneeded attributes and added calls to a couple different templates depending on the player used (copies of you XML method really)
I am working on setting up the page template right now, although I may not use it...

I am wondering 2 things.. Do you see any future problems with this approach? (I would like to have it require little maintenance for upgrades) and Is there a way to tell SlideshowProPage not to be listed in the pagetypes available?

sorry, 1 other thing.. is it possible to extend SlideshowProPage to allow SWF and FLV files? My slideshow player supports them and that would be very cool.



Forum Moderator, 4102 Posts

26 February 2010 at 8:49am

To hide the parent page use

static $hide_ancestor = "SlideshowProPage";

FLV is entirely possible. You would just have to change the ImageGalleryManager field to a standard FileDataObjectManager. If you have FFMPEG installed, FileDOM will encode and thumbnail video uploads on the fly.


Community Member, 178 Posts

26 February 2010 at 9:06am

Very cool... I'm getting excited.

I am learning so much with this... ;)

I have the page type removed... who knew that would be so easy.

I am a little lost about the next change though since that is in the grandparent of the class that I am working with right now.


Forum Moderator, 4102 Posts

26 February 2010 at 10:21am

Yeah, that's definitely tricky. Start with $fields->removeByName('GalleryImages'); (I think that's the relationship managed by ImageGalleryManager.. check ImageGalleryPage.php..


$fiends->addFieldToTab(... new FileDataObjectManager($this,'GalleryImages'... etc));

It will definitely take some programming chops, but it seems like you're well on your way. Good job with the subclassing and keeping the changes insulated from the core. That's the beauty of the Silverstripe framework. Takes a little extra time, but it's so much cleaner.


Community Member, 178 Posts

26 February 2010 at 11:40am

OK, I'm getting way lost here... So far based on going through the ImageGallery code and SlideShowPro code this is what I have..

		$FLVvideo = new FileDataObjectManager($this, 
			'GalleryImages', // Source from ImageGalleryPage.php
			'ImageGalleryItem', // class from ImageGalleryItem.php
			'FLVattachment', // File name on DataObject
				'Caption' => 'Caption', 
				'ImageGalleryPage' => 'ImageGalleryPage', 
				'Album' => 'Album'), 
		$f->addFieldToTab("Root.Content.SWF", new FileDataObjectManager($this,$FLVvideo);


I assume that FLVattachment is taking the place of the previous file relation?
Not sure I have the either of the Class or Source references correct, although they do look to be correct from what I found in your source. Do I have any other syntax error?? I'm getting a syntax/parse error/ class exists ()

I'm trying to use the example here:

I may need to step back a bit and try some samples from scratch.


Forum Moderator, 4102 Posts

26 February 2010 at 12:14pm

Yeah, the more I look at it, it seems like it would take more time to reverse engineer the thing into submission than it would to just build it from the ground up. ImageGallery gives you a lot of things you don't need, and you're just going to waste your time fighting with it.

I would just start with a page with a FileDOM .. use setAllowedFileTypes() to include all image extensions, and video extensions..

Then basically replicate the xml() function to give SSP a feed that it will like..

When looping through your images in the XML template, you could do something like

<% if ClassName = Image %>
<xml tag for image />
<% else_if ClassName = FLV %>
<xml tag for flv /> use $FLVLink to get the link to the encoded FLV
<% end_if %>