homepage Welcome to WebmasterWorld Guest from 54.227.20.250
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Dynamic XML File?
kieranmullen

5+ Year Member



 
Msg#: 4169410 posted 7:05 pm on Jul 13, 2010 (gmt 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

 

optik

5+ Year Member



 
Msg#: 4169410 posted 9:41 pm on Jul 13, 2010 (gmt 0)

you can use htaccess files to parse xml as php

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4169410 posted 12:46 am on Jul 14, 2010 (gmt 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 -->

kieranmullen

5+ Year Member



 
Msg#: 4169410 posted 8:42 am on Jul 15, 2010 (gmt 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'?>

optik

5+ Year Member



 
Msg#: 4169410 posted 6:52 pm on Jul 15, 2010 (gmt 0)

Trust me it works fine.

Use heredoc syntax to make it easier for yourself.

rocknbil

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4169410 posted 5:33 pm on Jul 16, 2010 (gmt 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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved