Topic: html link loads alternate .xml

Hi there,

Been using simple viewer pro for many a year. Love it.
I was just wondering if its possible to have an html link load a different flickr set ID? Or load an alternate .xml
Giving multiple galleries from a single page?

Thanks in advance

-W

william.im

Re: html link loads alternate .xml

If you would like one block of embedding code to load one of several XML files determined by a user's choice via HTML links, then you could use a query string in the links in conjunction with JavaScript.
In the page containing the HTML links to the page containing the embedding code, the links themselves might look like this:

<a href="gallery.html?xml=gallery1">Gallery 1</a>
<a href="gallery.html?xml=gallery2">Gallery 2</a>

The embedding code in the 'gallery.html' file might look like this:

<!--START SIMPLEVIEWER EMBED.-->
<script type="text/javascript" src="svcore/js/simpleviewer.js"></script>
<script type="text/javascript">
var flashvars={};
flashvars.galleryURL="gallery1.xml";
if (location.search)
{
    var qs=location.search, qa={}, re=new RegExp("([^?=&]+)(?:=([^&]*))?", "g"), qc=null;
    while (qc=re.exec(qs))
    {
        qa[qc[1]]=qc[2];
    }
    flashvars.galleryURL=qa["xml"]+".xml";
}
simpleviewer.ready(function () {
simpleviewer.load("sv-container", "100%", "100%", "222222", true, flashvars);
});
</script>
<div id="sv-container"></div>
<!-- END SIMPLEVIEWER EMBED -->

The code above uses the 'xml' query string value as the name of the XML file, the two XML files should be named 'gallery1.xml' and 'gallery2.xml' and the gallery will default to 'gallery1.xml' if no query string is used.

Steven Speirs
SimpleViewer Support Team.