Results 1 to 4 of 4

Thread: php generated xml vs hand typed

  1. #1
    Join Date
    Oct 2008
    Posts
    15
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default php generated xml vs hand typed

    php generated xml does not display images in flash, but the hand typed does, any ideas?

    Could this be caused by the filename being .php instead of .xml? I can't see any difference in the XML from the PHP vs the hand typed XML.

    I'm using ActionScript 3.0, Flash CS3.



    PHP generated XML (view source from php file data3.php) - doesn't work
    PHP Code:
    <?xml version="1.0"?>
    <slideshow>
     
     <photo url="http://xxxx/images/CelliOliveOilBlend.png" caption="1 Liter Bottle"/> 
      
     <photo url="http://xxxx/lava/images/1224858460.jpg" caption="6 Pack Bottles"/>
    </slideshow
    Flash load function for php xml file
    PHP Code:
    x.onLoad = function(success) {
        var 
    photos:Array = this.firstChild.childNodes;
        for(
    i=0;i<photos.length;i++) {
            
    urls.push(photos[i].attributes.url);
            
    captions.push(photos[i].attributes.caption);
        }
        
    holder.loadMovie(urls[0]);
        
    caption.text captions[0];
        
    whoIsOn 0;
    }

    x.load("data/data3.php"); 

    Hand typed XML - works - data3.xml
    PHP Code:
    <?xml version="1.0"?>
    <slideshow>
     
     <photo url="http://xxxx/images/CelliOliveOilBlend.png" caption="1 Liter Bottle"/> 
      
     <photo url="http://xxxx/lava/images/1224858460.jpg" caption="6 Pack Bottles"/>
    </slideshow
    Flash load function for xml data3.xml
    PHP Code:
    x.onLoad = function(success) {
        var 
    photos:Array = this.firstChild.childNodes;
        for(
    i=0;i<photos.length;i++) {
            
    urls.push(photos[i].attributes.url);
            
    captions.push(photos[i].attributes.caption);
        }
        
    holder.loadMovie(urls[0]);
        
    caption.text captions[0];
        
    whoIsOn 0;
    }

    x.load("data/data3.xml"); 

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Try removing the XML declaration from the PHP and see if it makes a difference.

  3. #3
    Join Date
    Oct 2008
    Posts
    15
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default

    you da man, the Medyman!

    Thanks! It worked.

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You should set an appropriate content-type:
    Code:
    header('Content-Type: application/xml');
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •