I have a what seems like simple issue. I would like to have my playlists auto populated with the files in a folder. So as mp3s are added to the folder the files are generated in the playlist.
I can display all the files in a folder and have the file names outputted on there own line using:
<?php
$dir = "app/vd/$val/";
$files = scandir($dir);
foreach ($files as &$file) {
if ($file!='.' && $file!='..' )
{
echo $file.'<br>';
}
}
?>
And I manually add files to the play list using:
<ul id="playlist" style="margin-left:auto; margin-right:auto;">
<li mp3="app/vd/<?php echo $val ?>/whatever.mp3" ogg="app/vd/<?php echo $val ?>/whatever.ogg" artist="<?php echo $val ?>" title="<?php echo $val1 ?>" ></li>
<li mp3="app/vd/<?php echo $val ?>/whatever2.mp3" ogg="app/vd/<?php echo $val ?>/whatever2.ogg" artist="<?php echo $val ?>" title="<?php echo $val1 ?>" ></li>
Any help would be greatly appreciated.
Just put it between the ul tags …
or to make it look nicer
P.S.: glob is a neat little function http://de3.php.net/manual/en/function.glob.php
P.P.S: iterators on directories are neat, too