Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Integrating Simplerviewer into Gallery module

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

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

Page: 1
Go to End
Author Topic: 2779 Views
  • bennybtl
    Avatar
    Community Member
    12 Posts

    Integrating Simplerviewer into Gallery module Link to this post

    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!

    http://www.airtightinteractive.com/simpleviewer/

    -Ben

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: Integrating Simplerviewer into Gallery module Link to this post

    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 !

  • bennybtl
    Avatar
    Community Member
    12 Posts

    Re: Integrating Simplerviewer into Gallery module Link to this post

    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>

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Integrating Simplerviewer into Gallery module Link to this post

    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/

  • bennybtl
    Avatar
    Community Member
    12 Posts

    Re: Integrating Simplerviewer into Gallery module Link to this post

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

    2779 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.