Topic: php driven xml - missing something blindingly obvious !?


I'm trying to dynamically create my xml file through php - the page loads the script but doesn't show any images

I've simplified the php to just output a single link to tall.jpg from the example

when I run this script through the php exe from it shows the script is working as expected (and I can even save this generated xml and successfully use it directly instead of the php)

- I'm obviously missing something obvious, but I've spent far too long banging my head against this, so thought I'd ask for help

here's the driving html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

<!-- saved from url=(0014)about:internet -->
<html xmlns="" xml:lang="en" lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <!-- Download SimpleViewer at -->
    <script type="text/javascript" src="swfobject.js"></script>
    <style type="text/css"> 
      /* hide from ie on mac \*/
      html {
        height: 100%;
        overflow: hidden;
      #flashcontent {
        height: 100%;
      /* end hide */
      body {
        height: 100%;
        margin: 0;
        padding: 0;
        background-color: #181818;

    <div id="flashcontent">SimpleViewer requires Macromedia Flash.<a href="">Get Macromedia Flash.</a> If you have Flash installed, <a href="index.html?detectflash=false">click to view gallery</a></div>
    <script type="text/javascript">
      var fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "7", "#802020");

      fo.addVariable("preloaderColor", "0x800000");
      fo.addVariable("xmlDataPath", "my_gallery.php");

and the php script


  $out  = array();
  $out  = '<?xml version="1.0" encoding="UTF-8"?>';
  $out .= '<simpleviewerGallery';
  $out .= ' maxImageWidth        = "1024"';
  $out .= ' maxImageHeight       = "1024"';
  $out .= ' textColor            = "0x996633"';
  $out .= ' frameColor           = "0xffffff"';
  $out .= ' frameWidth           = "5"';
  $out .= ' stagePadding         = "40"';
  $out .= ' thumbnailColumns     = "3"';
  $out .= ' thumbnailRows        = "5"';
  $out .= ' navPosition          = "left"';
  $out .= ' enableRightClickOpen = "true"';
  $out .= ' backgroundImagePath  = ""';
  $out .= ' imagePath            = "images/"';
  $out .= ' thumbPath            = "thumbs/"';
  $out .= ' title                = "blah"';
  $out .= '>';

    $out .= '<image>';
    $out .= ' <filename>tall.jpg</filename>';
    $out .= ' <caption>tall.jpg</caption>';
    $out .= '</image>';

  $out .= '</simpleviewerGallery>';

  echo $out;




Re: php driven xml - missing something blindingly obvious !?

Your html file validates to XHTML 1.0 Strict and the output from the php file is well-formed.
I don't see any problems with the code (perhaps I'm overlooking something, too!).

I've made a test gallery using your code.  I've made no changes at all to your html and php files (I just renamed one of my own pictures to 'tall.jpg' and added SimpleViewer v1.9 and Swfobject v1.5 to the mix).
The gallery can be found at and it seems to work fine.

The only thing I can think of is that perhaps your host does not have php enabled.

Last edited by Steven Speirs (2009-08-20 13:49:36)

Steven Speirs
SimpleViewer Support Team.

Re: php driven xml - missing something blindingly obvious !?


being incredibly new to php I was thinking firefox was processing the php when I'd access the html locally

the site views when I upload it to my host

- I've just installed apache and have the files located in the DocumentRoot, but things still aren't working

things are workable uploading to my host, but it would be nice to have things running locally

- thanks again for looking into this, I can at least make some headway now