hellonoko Posted October 1, 2008 Share Posted October 1, 2008 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 More sharing options...
adroit Posted October 1, 2008 Share Posted October 1, 2008 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>'; } } ?> Link to comment https://forums.phpfreaks.com/topic/126570-embeding-flash-within-a-loop-in-php/#findComment-654532 Share on other sites More sharing options...
hellonoko Posted October 1, 2008 Author Share Posted October 1, 2008 No luck. When I used your script directly with www.site.com It showed 3 broken flash links and 3 $key's. That is how many files are in the folder. But when I put the correct site in it only display the first button. Link to comment https://forums.phpfreaks.com/topic/126570-embeding-flash-within-a-loop-in-php/#findComment-654535 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.