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.

Archive /

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

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

Integrating Simplerviewer into Gallery module


Reply


5 Posts   2817 Views

Avatar
bennybtl

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!

[url]http://www.airtightinteractive.com/simpleviewer/[/url]

-Ben

Avatar
Fuzz10

Community Member, 787 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 !

Avatar
bennybtl

Community Member, 12 Posts

31 August 2008 at 11:22am

Edited: 31/08/2008 11:55am

UPDATE:

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="http://www.macromedia.com/go/getflashplayer/">Get Flash.</a></div>   
   <% control buildGallery %>
   
   <script type="text/javascript">
   
   
      var fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "8", "#181818");
      
      // SIMPLEVIEWER CONFIGURATION OPTIONS
      // To use an option, uncomment it by removing the "//" at the start of the line
      // For a description of config options, go to:
      // http://www.airtightinteractive.com/simpleviewer/options.html
         
      fo.addVariable("xmlDataPath", "$path");
      
      //fo.addVariable("firstImageIndex", "5");   
      //fo.addVariable("langOpenImage", "Open Image in New Window");
      //fo.addVariable("langAbout", "About");   
      //fo.addVariable("preloaderColor", "0xFFFFFF");
      
      fo.write("flashcontent");   
   </script>   
   <% end_control %>
   
</div>

Avatar
Willr

Forum Moderator, 5513 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 - http://open.silverstripe.com/browser/modules/slideshowpro/trunk/

Avatar
bennybtl

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...