Welcome to WebmasterWorld Guest from 54.146.239.96

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Dynamic XML File?

     

kieranmullen

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

5+ Year Member



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

optik

9:41 pm on Jul 13, 2010 (gmt 0)

5+ Year Member



you can use htaccess files to parse xml as php

rocknbil

12:46 am on Jul 14, 2010 (gmt 0)

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



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 -->

kieranmullen

8:42 am on Jul 15, 2010 (gmt 0)

5+ Year Member



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'?>

optik

6:52 pm on Jul 15, 2010 (gmt 0)

5+ Year Member



Trust me it works fine.

Use heredoc syntax to make it easier for yourself.

rocknbil

5:33 pm on Jul 16, 2010 (gmt 0)

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



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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month