|
Posted by Ralph Hφglund on 10/17/70 11:38
Pedro Graca skrev:
> Ralph HΓΆglund wrote:
>
>>The \n I write out to an open file does not work
>>the second time:
>>
>>$xmlstr = "<?xml version=\"1.0\"\x3F>\n";
>>$songstr = "<songs>\n";
>>
>> fwrite($handle, "$xmlstr"); //after this I got a new line
>> fwrite($handle, "$songstr"); //but not after this
Thanks all, I found out that I needed to use both \r and \n to
get it working. I am slowly getting the grasp of php programming now.
>
> <snip>
>
> in what mode did you fopen the file?
>
> /* open $filename in text mode */
> $handle = fopen($filename, "wt");
>
Well, I opened it with "w", no problem with that.
I had also to trim the lines from my m3u-file to get rid of
return and newline chars.
foreach ($lines as $line_num => $line) {
echo $line;
$line = trim($line);
fwrite($handle, " <song path=\"$line\"\r\n");
}
fclose($handle);
Now I have left the extraction of the song title to be invoked
into the end of lines as title = "song.mp3">
Will be back when (if) new problems arise.
Ralph in Sweden
Navigation:
[Reply to this message]
|