Welcome to WebmasterWorld Guest from 54.146.217.179

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Dynamic XML File?

     
7:05 pm on Jul 13, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:May 25, 2006
posts: 70
votes: 0


Currently I was using a flash photo viewer that would reference the jpg in the php file . SO making it dynamic based on directory contents or url was not hard.

Now it has moved to XML format where the XML file contains the jpg reference.

Any ideas where what I could do?

Thank you
9:41 pm on July 13, 2010 (gmt 0)

Full Member

5+ Year Member

joined:Aug 17, 2007
posts:320
votes: 0


you can use htaccess files to parse xml as php
12:46 am on July 14, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


Easy . . . .

header("content-type:text/xml");

then output valid XML from your PHP script. Flash will read it in either way. If your Flash .swf is configured with the XML source as the parameter,

addVariable('xmlsource','/files/slideshow.php'); // SWFobject

<param name="FlashVars" value="xmlsource=/files/slideshow.php">
<!-- clunky object code -->
8:42 am on July 15, 2010 (gmt 0)

Junior Member

5+ Year Member

joined:May 25, 2006
posts: 70
votes: 0


Thanks optik but modifying the .htaccess file for that directory to something like AddType application/x-httpd-php .xml would mean the entire xml file would be processed and there are many formatitng issues that would have to be addressed. I would get many unexpected T_STRING issues. For example it would throw an error on the first line <?xml version='1.0'?>
6:52 pm on July 15, 2010 (gmt 0)

Full Member

5+ Year Member

joined:Aug 17, 2007
posts:320
votes: 0


Trust me it works fine.

Use heredoc syntax to make it easier for yourself.
5:33 pm on July 16, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


I would get many unexpected T_STRING issues.


Well, you wouldn't, like any PHP file, it would only execute PHP between <?php and ?>. But it's a bit of overkill to mod the entire system for a few files with the Flash player. Just output XML from a script, also works fine, solution above.