|
Posted by Raoul van Hal on 01/11/06 14:09
I want to create a m3u playlist. I've created a while loop to write the
string to the textfile.
But after each token there needs to be a hard return in the textfile. Can
someone help me with this?
<?php
if (isset($_GET['lijst'])) {
$playlist = $_GET['lijst'];
$m3ufile = fopen("music/test.m3u", "ab");
$tok = strtok ($playlist, "^");
while ($tok) {
if ($tok != "") {
echo "<br> $tok" ;
fwrite($m3ufile, $tok);
$tok = strtok ("^");
} else {
$tok = strtok ("^");
}
}
fclose($m3ufile);
}
?>
This is the output in the m3ufile :
beatwalking.mp3 DJ Pilze - Birdshitonblackshoe.mp3 DJ Pilze - 1st-jungle.mp3
DJ Pilze - 1st-jungle.mp3 DJ Pilze - herewego.mp3
and it needs to be :
beatwalking.mp3
DJ Pilze - Birdshitonblackshoe.mp3
DJ Pilze - 1st-jungle.mp3
DJ Pilze - 1st-jungle.mp3
DJ Pilze - herewego.mp3
As you can see there is a newline after each song.
I appreciate the help,
Greetings raoul
Still learning :-)
Navigation:
[Reply to this message]
|