PDA

View Full Version : how to grab part of current url and pass as variable


swisslyons
01-22-2005, 01:12 AM
i am trying to integrate a flash image slider GUI into a dynamic site:

i need to be able to grab the id from a url like this:

index.php?option=com_hotproperty&task=view&id=1&Itemid=40

how can i get the id=1 part into my flash?

my swf will be displaying on this url... and additionally it loads a php file that does a sql select, formats xml and outputs the data back to the swf.

for live example of what I am working on:

the page where the flash WILL eventually be placed:

http://www.musci-immobilien.ch/index.php?option=com_hotproperty&task=view&id=1&Itemid=40


the temporary testing page with the id=1 hardcoded in for now:

http://www.musci-immobilien.ch/index.php?option=com_wrapper&Itemid=46


hope that i explained this clear enough...

can I parse the url of the ppage my swf is embeded on to get the id varaible that i need?

Can i use javascript to do this?

whats the way?

thanks in advance

xxlm
01-23-2005, 09:35 PM
OK when going on this php page holding the swf just pass the variable to flash using flashvars.
As you get the id already, you could simply do this
<param name="flashvars" value="&id=<?=$id;?>" />

and don't forget to put it inot the embed tag too like
flashvars="&id=<?=$id;?>"

C ya