Topic: xml from database with php

I don't use gallery.xml but for example:  "gallery2.php?key=Namibia-D04-NL-562-18-CLASSIC" This php page creates an xml with data from my database.

In V1.9 is this no problem
<script type="text/javascript">
        var fo = new SWFObject("", "viewer", "100%", hoogteview, "7", "#000000");   
        fo.addVariable("preloaderColor", "#994500");
        fo.addVariable("xmlDataPath", "<?php echo $gallerij ?>");
        fo.addParam("wmode", "transparent");

But I can't find the way to do that in V2.3.0
I will that my visitors can make a choice how the will see the pictures; CLASSIC, MODERN or COMPACT

You can see it works on
How the php/xml works … 18-CLASSIC

Re: xml from database with php

In SimpleViewer v2.3.0, you can point towards a specific XML file using the galleryURL option as a flash variable in the embedding code.
Assuming '$gallerij' is the path to your PHP file (with the required query string) which dynamically creates the XML code, then your embedding code would look like this:

<script type="text/javascript" src="svcore/js/simpleviewer.js"></script>
<script type="text/javascript">
var flashvars={};
flashvars.galleryURL="<?php echo $gallerij; ?>";
simpleviewer.ready(function () {
simpleviewer.load("sv-container", "100%", "100%", "222222", true, flashvars);
<div id="sv-container"></div>

However, you would also need to modify your 'gallery2.php' page so that it outputs the required information in the SimpleViewer v2.x XML format (which differs from the SimpleViewer v1.x XML format) as follows:

<simpleviewergallery option1="value1" option2="value2">
    <image imageURL="images/image1.jpg" thumbURL="thumbs/thumb1.jpg" linkURL="images/image1.jpg" linkTarget="_blank">
        <caption>Caption #1 goes here</caption>
    <image imageURL="images/image2.jpg" thumbURL="thumbs/thumb2.jpg" linkURL="images/image1.jpg" linkTarget="_blank">
        <caption>Caption #2 goes here</caption>
Steven Speirs
SimpleViewer Support Team

Re: xml from database with php

Thanks for you reply. I know that I need to adjust gallerij2. php. But the most important thing was to be able to a php calls. I'm going to try the no you've answered!

4 (edited by davidbrouwer 2012-09-14 11:46:46)

Re: xml from database with php

Nowhere In your reply I see a link to "simpeleviewer .swf" is that not necessary?
Or should "simpeleviewer .swf" on a fixed location?

Location of the "index" =
Location of the simpleviewer.js =
Laocation of swfobject.js =
Location of simpleviewer.swf =
Location of gallery.xml (gallerij.php) =

Re: xml from database with php

SimpleViewer v1.x involved embedding only a single SWF file.

SimpleViewer v2.1.x onwards incorporates 'Universal Playback': … #universal
... whereby the Mobile Player is used to display the gallery on mobile devices and in browsers which do not have Adobe Flash Player installed and enalbe.
In order to achieve this functionality, SimpleViewer now contains a 'svcore' folder (rather than a single SWF file) which contains a collection of CSS, HTML, JavaScript, SWF and image files.
The structure of the 'svcore' folder must be kept intact.

In order to embed a current (v2.3.0) SimpleViewer gallery in a web page, please see the SimpleViewer Embedding Guide.

Steven Speirs
SimpleViewer Support Team

Re: xml from database with php

It works, thank you. But I have also found a bug.

Pass a Java string variable for the width in the simlpleviewer. load command does not work. A variable for the height works good.

for example:
viewWidth = screen.availWidht-280
simpleviewer.load("sv-container", viewWidthviewHeight, "", true, flashvars);

Set this variable with PHP than works it.

simpleviewer.load("sv-container", "<?php echo $viewWidth?>",  viewHeight, "", true, flashvars);

Re: xml from database with php

Pass your viewWidth and viewHeight variables as Strings (which is what SimpleViewer is expecting), e.g.

simpleviewer.load("sv-container", viewWidth.toString(),  viewHeight.toString(), "transparent", true, flashvars);
Steven Speirs
SimpleViewer Support Team