Link to home
Start Free TrialLog in
Avatar of ditterz
ditterz

asked on

Replace Windows Media Player slideshow with either Flash or Javascript slideshow

I need to replace the Windows Media ASX player slideshow with a Javascript or Flash slideshow on an AJAX driven site (see code supplied from relevant page). I developed a Flash slideshow that pulled images from the database, but I need to tell Flash the client number that the user selected, but it's written in the URL, not the database. I got a flash file from Flashden: flashden_dynamic-slideshow_4316 and it has the features we want. I've got the Flash file reading XML created on the fly by a php file, but I can't write the client number to XML. I think javascript would be easiest, but I am a newbie at AJAX and am having trouble figuring out how to implement this. I'm looking at Jquery slideshows, but can't find a nice example. Can anyone help?
<?php require_once('Connections/connWebsite.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
$colname_rsAsxinit = "-1";
if (isset($_GET['vid'])) {
  $colname_rsAsxinit = (get_magic_quotes_gpc()) ? $_GET['vid'] : addslashes($_GET['vid']);
}
mysql_select_db($database_connWebsite, $connWebsite);
$query_rsAsxinit = sprintf("SELECT img1, img2, img3, img4, img5, img6, img7, img8, img9, img10, img11, img12, img13, img14, img15 FROM wdshow_videolist WHERE vid = %s", GetSQLValueString($colname_rsAsxinit, "int"));
$rsAsxinit = mysql_query($query_rsAsxinit, $connWebsite) or die(mysql_error());
$row_rsAsxinit = mysql_fetch_assoc($rsAsxinit);
$totalRows_rsAsxinit = mysql_num_rows($rsAsxinit);
?>
<ASX VERSION = "3.0">
<TITLE>Image Gallery</TITLE>
<?php
	for ($i = 1; $i <= 15; $i++) {
		if($row_rsAsxinit['img'.$i] != '') {
 
?>
   <ENTRY>
	
      <REF HREF="http://<?php echo $_SERVER['SERVER_NAME'] . "/imgcatalogue/" . $row_rsAsxinit['img'.$i]; ?>" />
 
   </ENTRY>
<?php 
		}
	}
?>          
</ASX>
<?php
mysql_free_result($rsAsxinit);
?>

Open in new window

Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Please explain the relevancy of the client number and why you cannot write it to the xml or get it from the url into flash?

http://www.google.com/search?q=querystring+flash
Avatar of ditterz
ditterz

ASKER

The client number (represented in the code by "vid")  tells the slideshow which database record holds the 15 image names that we want to display. The client number must be used by the slides.php file to run a query on the database and generate xml including the image names belonging to the client the user has selected. As Flash doesn't run the query itself, passing it the client number won't help unless it can in turn pass it to the slides.php eg: "slides.php?vid=210", like a web page would pass it.
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Flash isn't my expertise but if you basically need a dynamic xml file and the Flash is what uses it then have that PHP page make it.  It sounds like that is your intent now.  The Flash script or file can just use the PHP instead of an xml file.  You include the vid in the URL used.  The key is the PHP file needs to send headers so the browser will realize the content is xml (e.g. header("Content-type", "text/xml"); ).  That way the file is made dynamically based on the query string in the URL but the Flash file gets its xml file.
Let me know if you have a question about this or if I have misunderstood something.
bol
Avatar of ditterz

ASKER

I tried writing the xml file using the php like that already, but it didn't work, however I will try putting the full URL in the query string and advise the result.
Avatar of ditterz

ASKER

I haven't been successful in getting Flash to read the query string. Flash is happy with the slides.php file which generates xml on the fly when flash looks for this as an xml file: slides.php as per actionscipt snippet attached, however it is not looking for a URL with a query string in it. I also haven't been able to write an xml file as I am using the XAMPP implementation of Apache, Mysql and PHP which gives errors when I try to get PHP5 to write a test xml file:

Warning: domdocument::domdocument() expects at least 1 parameter, 0 given in C:\xampp\htdocs\ajax\articles.php on line 3

Fatal error: Call to undefined method domdocument::load() in C:\xampp\htdocs\ajax\articles.php on line 4]]

One thing I have found out about this website is that it uses MX Kollection from Interakt, and that this is replaced by the Dreamweaver Developer Toolbox. At least now I know where this complex code comes from. If only I could find a way to integrate a Flash Slideshow with this toolbox so a different clients slideshow comes up when you search for a client and click PLAY.
var xml_file:String = "slides.php";

Open in new window

Avatar of ditterz

ASKER

Thankyou so much. It took me a day of testing though, as I had to receive the querystring in flash, then pass it out to the php file which created the xml that flash required, then it used SWFObject, rather than the standard embedded Flash object, plus the variable was used inside a movie clip so I had to test that it could read it from the root of the flash file. Then flash cached and pretended it wasn't working until I changed the filename for each test. But yes it is working! Luckily the first link had enough info to run a simple test which spurred me to persist. I am very happy to have received your help. Just knowing to search on "querystring" helped enormously as I didn't know where to start. Thanks again.
You are welcome

I am posting you comment so it is shown here too

"Thankyou so much. It took me a day of testing though, as I had to receive the querystring in flash, then pass it out to the php file which created the xml that flash required, then it used SWFObject, rather than the standard embedded Flash object, plus the variable was used inside a movie clip so I had to test that it could read it from the root of the flash file. Then flash cached and pretended it wasn't working until I changed the filename for each test. But yes it is working! Luckily the first link had enough info to run a simple test which spurred me to persist. I am very happy to have received your help. Just knowing to search on "querystring" helped enormously as I didn't know where to start. Thanks again."