chordsoflife Posted April 17, 2008 Share Posted April 17, 2008 So I've got the concepts of PHP down, and I've read more PHP lessons than classes I've taken for my actual major, yet I'm still not clear on things. What I'm doing, I think, is pretty basic, and I was hoping someone could lend a hand. Basically, I've got a folder full of mp3's and flac's, and I want to output them into a table without coding each page by hand. Example (of one of many tracks): <tr> <td>Track 01</td> <td><a href="artist-date-t01.mp3"> <?php echo formatbytes(filesize("artist-date-t01-t01.mp3")); ?> </a> </td> <td><a href="artist-date-t01-t01.flac"> <?php echo formatbytes(filesize("artist-date-t01-t01.flac")); ?> </a> </td> <td># Downloads</td> </tr> So I think the process would be running through the folder and storing them all in an array, and then outputing them via a while loop? Hewlp? Quote Link to comment Share on other sites More sharing options...
AP81 Posted April 17, 2008 Share Posted April 17, 2008 The answer is in the PHP manual. Have a look at the readdir function. There is an example there that explains exactly what you want to to. http://au.php.net/readdir Quote Link to comment Share on other sites More sharing options...
DJTim666 Posted April 17, 2008 Share Posted April 17, 2008 Just loop through all the files in the directory and display a table to represent them. Check out this section of php.net for the filesystem function reference list. -- DJ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.