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:

Archive /

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

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

Integrating Simplerviewer into Gallery module

Go to End

5 Posts   3187 Views


Community Member, 12 Posts

31 August 2008 at 4:28am

Hello all,

I'm planning to hack the Gallery module to optionally use the Simpleviewer flash gallery. The one thing I'm struggling with is the xml file for SV.

If I add a new function within gallerypage.php to generate the code, how/when/where do I call the function? I'm thinking it should generate the xml when it creates the thumbnails. I'm looking at adding it to GalleryItems(). SV pagenates, so prev,next would be unused.

I'm lightly seasoned in PHP, and by no means an expert (more familiar with procedural, not OOP). Any help, insight would be appreciated. Thanks!



Community Member, 791 Posts

31 August 2008 at 4:49am

Hi Ben and welcome !

Good idea!

I don´t know Simpleviewer , but I understand it needs an XML file containing the filenames and captions, right ?

My guess is you'd have to create a new template (within the gallery module) to create the XML file and feed it with the image-data.

I'll have a more detailed look later , because I'd like to add Piclens support to the gallery.

Good luck !


Community Member, 12 Posts

31 August 2008 at 11:22am

Edited: 31/08/2008 11:55am


I have pretty much everything working now, except this:

I have a function buildGallery() that creates all the thumbnails, generates the xml file and is supposed to return the xml file's path. But when the template is processed, nothing inside the control block appears. (but the function runs correctly, everything is created)

Any idea what could be wrong?

I'm sure I'm doing it wrong, I don't really get OOP.

<div id="ImageGallery">
	<div id="flashcontent">SimpleViewer requires JavaScript and the Flash Player. <a href="">Get Flash.</a></div>	
	<% control buildGallery %>
	<script type="text/javascript">
		var fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "8", "#181818");
		// To use an option, uncomment it by removing the "//" at the start of the line
		// For a description of config options, go to: 
		fo.addVariable("xmlDataPath", "$path");
		//fo.addVariable("firstImageIndex", "5");	
		//fo.addVariable("langOpenImage", "Open Image in New Window");
		//fo.addVariable("langAbout", "About");	
		//fo.addVariable("preloaderColor", "0xFFFFFF");
	<% end_control %>


Forum Moderator, 5523 Posts

31 August 2008 at 2:34pm

The buildGallery returns what? You probably dont need to put that JS in the control syntax as the control syntax is pretty much a foreach loop. If your buildGallery just returns $path then what you need to do is remove the control loop and just have $buildGallery where $path is. Then having $buildGallery it will call buildGallery() and go off and do its thing and then return the path.

If you need some ideas on flash + xml + gallery integration I just did I slideshowpro version for a client -


Community Member, 12 Posts

31 August 2008 at 3:54pm

Oh, yes that's so obvious, I will give it a try, thanks! I didn't think the control loop really made sense...