Topic: Problem with dynamic XML generation with PHP

Hi all,

I am having a problem when trying to make SimpleViewer work when I dynamically generate the XML file.

Here is what I do:

<script type="text/javascript">
   var fo = new SWFObject("components/com_gallery/viewer.swf", "viewer", "100%", "100%", "7", "#181818");    
   fo.addVariable("preloaderColor", "0xffffff");
   fo.addVariable("xmlDataPath", "index.php?option=com_gallery&task=makealb");

The xmlDataPath is in fact a call a page that returns xml content using php header function:

$xmlCode = makeXML();
header('Content-Type: application/xml; charset=UTF-8');
header('Content-Disposition: inline; filename="alb.xml"');
header("Content-Length: ".strlen($xmlCode ));
header('Expires: 0');
header('Pragma: cache');
header('Cache-Control: private');
echo $xmlCode ;

I have checked the data the above code sends and it is a valid gallery xml file.

I would like to know if someone spoted something wrong with the php code or if there is a limitiation of SimpleViewer that prevents doing this.

Thanks a lot,


Re: Problem with dynamic XML generation with PHP

Dynamically generated XML should work fine. What error are you seeing?

Felix Turner
SimpleViewer Support Team.

Re: Problem with dynamic XML generation with PHP


Thanks for answering.

Well, the viewer just displays some white crosses. I think there is some data provided to the viewer but it should not be valid.

I changed the "Content-Disposition" header to "attachment" and downloaded the resulting file. The content is correct.

I am running my test locally. Could this have an effect ?

Thanks a lot,