Topic: Problem with dynamic XML

Hi there,

Please could you assist. I've been trying to develop a component for Joomla that would allow one to insert simpleviewer galleries into Joomla articles. For some reason however, the XML file being generated does not work with simpleviewer and the error 'No images specified in gallery xml' is shown. However, when I take the exact same XML code being generated by the component and create a new XML file (gallery.xml) and paste code into that file and point simpleviewer to that file instead... it works perfectly. The XML headers are also being set by the component, and the XML is being generated correctly. I have even bought the pro version now in hope that it might work there, but still no luck...

The link to the component page is:
http://www.johnbowersgallery.com/index. … _svgallery

And the following XML is being generated and used:
http://www.johnbowersgallery.com/index. … format=raw

You will see that the XML file is being created correctly.

Please urgently assist?

Thank you

Re: Problem with dynamic XML

imageURL="/bowers/components/com_svgallery/galleries/private/images/JBS-PARENTS-WEDDING.jpg"

When I take an image url from your XML and add your domain name I get a 404 not found error. Are you sure you are pointing to the correct location?

http://www.johnbowersgallery.com/bowers … EDDING.jpg

Mike Richards
SimpleViewer Support Team.

Re: Problem with dynamic XML

Hi Mike,

Yes, sorry that was just for my localhost version. I have updated the XML file to point to the correct images. You will notice the same problem still appears.

Re: Problem with dynamic XML

Do you have a content type in the file generating the XML?

<?php
header ("Content-Type:text/xml");
?>

Add  //<![CDATA[ and //]]> so that it encapsulates the JavaScript code

    <script type="text/javascript">
    //<![CDATA[
        var flashvars = {};
        flashvars.galleryURL = "/index.php?option=com_svgallery&tmpl=component&format=raw";
        //flashvars.galleryURL = "http://localhost/bowers/index.xml.php?option=com_svgallery&format=xml";
        jQuery(document).ready(function () {
            SV.simpleviewer.load("sv-container", "960", "540", "000000", true, flashvars);
        });
    //]]>
    </script>

Do you have any hot linking/image protection setup on your server?

Mike Richards
SimpleViewer Support Team.

Re: Problem with dynamic XML

Hi Mike,

Yes the header is being set via Joomla. You will also notice the XML is being generated correctly at the URL provided - http://www.johnbowersgallery.com/index. … format=raw

I have also added the CDATA code, and no there isn't any hot linking/image protection.

I have even created my own AS 3 flash file, and loaded the XML file at the above URL and successfully reading the images from it? I have pasted the little AS 3 snippet below and this works properly. It returns the amount of images in the file and can even access the images.


import flash.xml.XMLDocument;

var albumLoader:URLLoader;

var albumListURL:URLRequest = new URLRequest("http://www.johnbowersgallery.com/index.php?option=com_svgallery&tmpl=component&format=raw");
albumLoader = new URLLoader();
albumLoader.addEventListener(Event.COMPLETE, loadAlbumsHandler);
albumLoader.load(albumListURL);

function loadAlbumsHandler(event:Event):void
{
    var xmlData:XML = new XML(event.target.data);
   
    trace(xmlData..image.length());
   
    for each(var prop:XML in xmlData.image)
    {
        trace(prop.toString());
    }

}

Re: Problem with dynamic XML

The second 2 params in your galleryURL are being ignored. So SimpleViewer is loading this URL:

http://www.johnbowersgallery.com/index.php?option=com_svgallery

FlashVar parameters must be URL encoded. The solution is to url encode the galleryURL string. Use this tool to encode strings: http://meyerweb.com/eric/tools/dencoder/

Felix Turner
SimpleViewer Support Team.

Re: Problem with dynamic XML

Hi Felix,

Thank you so much. That does the trick. Would never have guessed it!

Funny how the AS 3 file that I made worked correctly though? Or does SimpleViewer parse the URL differently than I had done it in that snippet of code?

Thanks again.

Re: Problem with dynamic XML

Hi Felix,

Sorry I actually just answered my own question there! My AS 3 file obviously references the XML file directly and does not do so via FlashVars. So all this time it was just the fact that the URL is passed via FlashVars that stops it from working properly. Been having such headaches on this on trying just about everything in the book...

Well, thanks for spotting that.

Cheers