Jump to content

embeding flash within a loop in php


hellonoko

Recommended Posts

I have a simple script that reads through a directory of files (mp3s) and displays the files.

The script also uses the XSPF player to show a small Flash mp3 player for each file so that the mp3 can be previewed.

 

However when I run the script only the first song button and not the song name will show up.

 

I have a feeling it is something to do with the quotes of the embedded flash but am not sure.

<?php

   	$arr = array();

   	foreach (glob("*.*") as $filename) 
   	{
      	$arr[$filename] = filemtime($filename);

   	}

   	arsort($arr);
   	echo "<br>";

   	foreach($arr as $key => $value) 
{
    	
	if ( $key !== "filelist3.php")
	{

		echo "<object type="application/x-shockwave-flash" data="http://www.site.com/button/musicplayer.swf?&song_url=http://www.site.com/REPOSITORY/$key" width="17" height="17">";
		echo "<param name="movie" value="http://www.site.com/button/musicplayer.swf?&song_url=http://www.site.com/REPOSITORY/$key"/>";

		echo "<img src="noflash.gif" width="17" height="17" alt="" />";
		echo " $key<br>";
	}
   	} 
?>

 

Any ideas?

 

Thanks for your help,

ian

Link to comment
https://forums.phpfreaks.com/topic/126570-embeding-flash-within-a-loop-in-php/
Share on other sites

Try the following

 

<?php

 

  $arr = array();

 

  foreach (glob("*.*") as $filename)

  {

      $arr[$filename] = filemtime($filename);

 

  }

 

  arsort($arr);

  echo "<br>";

 

  foreach($arr as $key => $value)

{

   

if ( $key !== "filelist3.php")

{

 

echo '<object type="application/x-shockwave-flash" data="http://www.site.com/button/musicplayer.swf?&song_url=http://www.site.com/REPOSITORY/$key" width="17" height="17">';

echo '<param name="movie" value="http://www.site.com/button/musicplayer.swf?&song_url=http://www.site.com/REPOSITORY/$key"/>';

 

echo '<img src="noflash.gif" width="17" height="17" alt="" />';

echo ' $key<br>';

}

  }

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.