I use the following script to scan a folder to look for .flv and creat a playlist the problem is that the list is not alphabetical. Here is the coding i use. Here is an example http://video.somplanet.com/
PHP Code:
<?php
//----------------------------------------------------------------------------------------- // the variables you have to set //-----------------------------------------------------------------------------------------
// width of the video $width = 320;
// height of the video $height = 240;
//----------------------------------------------------------------------------------------- // rest of the php part //-----------------------------------------------------------------------------------------
// getting the file from the url if ($_GET['file']) { $file = $_GET['file']; } else { $file = 1; }
// extracting the name of the video $p1 = strrpos($files[$file-1],"/") + 1; $p2 = strpos($files[$file-1],".flv"); $name = substr($files[$file-1],$p1,($p2-$p1));
//----------------------------------------------------------------------------------------- // displaying the html page //----------------------------------------------------------------------------------------- ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>FLV Player Playlist</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
I'm not quite sure what you're asking. sort() will sort the array in alphabetical order so if you add the code:
sort($files);
before the for loop in your code above it will place all of the values in the $files array in alphabetical order like you want. Let me know if that works or if you need more help.
Sorry. I didn't see that you were using the array in your code for the flvplayer. Where did you add the sort() code? I think it just needs to be before the flvplayer code.
Try putting it much closer to the top just before:
// getting the file from the url
if ($_GET['file']) { $file = $_GET['file']; } else { $file = 1; }