DavidNels
Oct 18th, 2008, 04:58 PM
Hey,
How can I get php variables in my page to an .XML file?
Let's say on my index.php I have a variable called $test and it's value is dynamic and changes depending on user input.
Now how can I pass $test to my xml file when I tell the page to read the xml file?
Let me know if you need any clarification. :-)
(So I could have entries in my XML like:
<photo>http://site.com/<?=$_GET['2']?>/0.jpg</photo>
DavidNels
Oct 19th, 2008, 10:17 AM
Just a bit more info of what I'm looking to do here.
I have a flash file which uses an XML file to output dynamic content. The content which is in the XML file determines what the SWF ultimately outputs (it's like a photo gallery/slideshow)
However, rather than me specifying what I want it to show, I have it on a php page and was wanting to pass a few variables into the XML file, which in turn will output the new user-generated dynamic results.
So lets say we have a php variable $photo1, and the user sets it to http://www.google.com/logo.jpg
I am wanting my XML file to be able to place that variable where I tell it to. Like this,
<?xml version="1.0" encoding="utf-8"?>
<slide_show>
<photo>{$photo1}</photo>
<photo>{$photo2}</photo>
</slide_show>
But I for the life of me cannot figure out how to pass these variables on the php page to the XML...
Here's how the XML is deployed/initiated, through a parameter in the flash embedded object which I'm using SwfObject for.
<script type="text/javascript">
swfobject.embedSWF("album.swf", "album1", "100%", "150", "9.0.0", false, {xmlfile:"album.xml", allowFullScreen:"True", loaderColor:"0xFFFFFF"}, {wmode: "transparent"});
</script>
I've tried all I can think of to get the variables across to the XML file, but every time it either results in an error with the slideshow or it simply doesnt do what its supposed to.
Can I pass it through the URL, something like the following (which didnt work)?
<script type="text/javascript">
swfobject.embedSWF("album.swf", "album1", "100%", "150", "9.0.0", false, {xmlfile:"album.xml?photo1=<?=$photo1?>&photo2=<?=$photo2?>", allowFullScreen:"True", loaderColor:"0xFFFFFF"}, {wmode: "transparent"});
</script>
Any help is greatly appreciated.
Thanks!!
penagate
Oct 22nd, 2008, 06:10 PM
Could we sidestep the XML issue and pass the variables directly to the SWF object in a query string, or is that not an option?