Jump to content

Passing Arguments...


Clumps

Recommended Posts

I have a javascript ("js.js") document that passes the following code...

 

function launchPhoto(GalleryID, PhotoID) {

  win = window.open('photo.php?GalleryID=' + GalleryID + '&PhotoID=' + PhotoID,'video', 'width=570,height=570');

  win.focus();

 

The code is populated from a flash SWF file (GalleryID and PhotoID refer to XML snippets).  The code is PASSED to a photo.php document where the browser shows the name changes to photo.php?GalleryID=12345&PhotoID=0 (for example) but the contents of photo.php (namely

 

    <param name="movie" value="photoviewer.swf?intGalleryID=&intPhotoID=">

    <param name="quality" value="high"><param name="BGCOLOR" value="#000000">

    <embed src="photoviewer.swf?intGalleryID=&intPhotoID=" width="560" height="560" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#000000"></embed>

 

fail to change along with the name of the file (where 'intGalleryID=&intPhotoID' should change to 'intGalleryID=12345&intPhotoID=0 as per the name change of the file itself).

 

Any ideas why?  I'm not sure if this is a problem with the code or what.  I'm obviously inexperienced but any assistance would help.

 

Thanks,

Clumps

Link to comment
Share on other sites

Hello,

 

If you are seeing the variables correctly up in the URL of the browser, then the problem is in your photo.php file.. That's the file that is responsible for taking the variable from the URL (usually through the $_GET superglobal) and outputting it properly in the HTML code.. If you don't see a problem, please post the portion of code from photo.php that is responsible for outputting the <param name > lines of the HTML and I should be able to help more..

 

Shawn

Link to comment
Share on other sites

Hi Shawn,

 

Thanks for the reply.  I had the post in "PHP help" but they moved the post to Javascript help. Go figure.The PHP file, in it's entirety, is posted below.  I'm working on a site that someone else started and am trying to get it to run and this has me stumped.  I'll be sure to Google the get superglobal. So much to learn...

 

 

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Test</title>

<style type="text/css">

<!--

body,td,th {

font-family: Arial, Helvetica, sans-serif;

color: #FFFFFF;

}

body {

background-color: #000000;

margin-left: 0px;

margin-top: 0px;

margin-right: 0px;

margin-bottom: 0px;

}

-->

</style></head>

<body><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="560" height="560">

    <param name="movie" value="photoviewer.swf?intGalleryID=&intPhotoID=">

    <param name="quality" value="high"><param name="BGCOLOR" value="#000000">

    <embed src="photoviewer.swf?intGalleryID=&intPhotoID=" width="560" height="560" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#000000"></embed>

  </object>

</body>

</html>

 

Link to comment
Share on other sites

Hmm, it looks like your PHP file has no PHP in it at all, lol.. Making this change should be a quick fix:

 

    <param name="movie" value="photoviewer.swf?intGalleryID=<?php echo $_GET['GalleryID']; ?>&intPhotoID=<?php echo $_GET['PhotoID']; ?>">

    <param name="quality" value="high"><param name="BGCOLOR" value="#000000">

    <embed src="photoviewer.swf?intGalleryID=<?php echo $_GET['GalleryID']; ?>&intPhotoID=<?php echo $_GET['PhotoID']; ?>" width="560" height="560" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#000000"></embed>

 

Hope that helps!

 

Link to comment
Share on other sites

Wow, that actually got the arguments passed. Thank You so much.  Now the only problem is that the browser reads the different XML IDs (I have 10 galleries in all) but only loads the first ID no matter which I click on.  So, to reiterate, the browser shows "ID1" or "ID2" but only reads ID1, no matter which. Any ideas?

Link to comment
Share on other sites

Actually, I just discovered it's loading all of the XML file rather than just the gallery I ask it for. Hence, it loads the whole gallery, reads the first gallery, then seems to stop once it hits the </gallery> of the first gallery.

 

Hmm...

Link to comment
Share on other sites

You're welcome :)

 

Where is the XML file being read from? I'm guessing it's being read from the Flash file? If so, then it might be a problem in the Flash file, or it could be a problem with how you are trying to pass the arguments to the Flash file.. Try changing it to this and see if it helps:

 

    <param name="movie" value="photoviewer.swf">

    <param name="intGalleryID" value="<?php echo $_GET['GalleryID']; ?>">

    <param name="intPhotoID" value="<?php echo $_GET['PhotoID']; ?>">

    <param name="quality" value="high"><param name="BGCOLOR" value="#000000">

    <embed src="photoviewer.swf?intGalleryID=<?php echo $_GET['GalleryID']; ?>&intPhotoID=<?php echo $_GET['PhotoID']; ?>" width="560" height="560" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" bgcolor="#000000"></embed>

 

If that doesn't help, then I'd guess it's a problem with the Flash file not handling the variables properly.. Make sure that "intGalleryID" and "intPhotoID" are the correct variable names that the Flash file is expecting..

 

Link to comment
Share on other sites

Hmmm.  hasn't helped...The flash file contains the following...

 

ruXML.load(_root.strXMLURL + "/xml/gallery.xml?GalleryID=" + intGalleryID);

 

Paths seem to be correct on that one...

 

the XML file contains the following tree structure...

 

<?xml version="1.0" encoding="UTF-8"?>

<galleries>

<gallery ID="12345" gname="Name">

</gallery>

<gallery ID="22345" gname="Name">

</gallery>

</galleries>

 

seems so close, eh?

Link to comment
Share on other sites

Yeah, seems close.. I would recommend adding some debugging lines to the Flash file so you can make sure that intGalleryID is being passed into the Flash file properly.. Once you know for sure that intGalleryID is correct, then you would have it narrowed down to being something else in the Flash file.. It sure seems like one of the methods that we discussed earlier would pass in the variables to the Flash file properly, but stranger things have happened :)

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.