jordanking
Programmer
- Sep 8, 2005
- 351
Hello,
I have a php page that retrieves the content of a text file from a remote server (same server as the php page).
I put the contents of the file into a variable ($f_contents) and then convert it to a string. This text file is a source file for an older version of flash. The flash movie imports its contents into the swf. Anyway, the version of flash needs the <br> tag for all new lines. I want to be able to have the <br> replaced with the "\n" so that it displays in the text area exactly as it would in the swf movie. I have tried the following string replace method but all that happens is the <br> is replaced by the "\n" and the "\n" get printed litterally.
Here is the relevant sections of my code.
then later on i echo the contents in this way:
If i have:
Can someone tell me how to have the \n truly evaluated to a new lie within the text area tag?
Thanks in advance.
I have a php page that retrieves the content of a text file from a remote server (same server as the php page).
I put the contents of the file into a variable ($f_contents) and then convert it to a string. This text file is a source file for an older version of flash. The flash movie imports its contents into the swf. Anyway, the version of flash needs the <br> tag for all new lines. I want to be able to have the <br> replaced with the "\n" so that it displays in the text area exactly as it would in the swf movie. I have tried the following string replace method but all that happens is the <br> is replaced by the "\n" and the "\n" get printed litterally.
Here is the relevant sections of my code.
Code:
$f_contents = strval($f_contents);
$f_contents = str_replace('<br>', '\n', $f_contents);
then later on i echo the contents in this way:
Code:
<textarea name="contents" class="textContent" id="contents"><?php echo "$f_contents"; ?></textarea>
If i have:
this litterally returnshello world<br> this is your movie.
hello world\n this is your movie.
Can someone tell me how to have the \n truly evaluated to a new lie within the text area tag?
Thanks in advance.