Re: Question about new lines [message #175503 is a reply to message #175489] |
Mon, 03 October 2011 05:15   |
Gordon Burditt
Messages: 2 Registered: March 2011
Karma:
|
Junior Member |
|
|
> I come from a scripting background so am not unfamiliar
> with the concept of CR/LF characters. I am in the process
> of learning PHP via the following tutorial
A newline in output interpreted as HTML is rendered no differently
from a space or series of spaces. It shows up as a newline in "view
source" of browsers but not in rendered HTML.
If you want to cause a line break, do it in HTML. <br> and <p> are
commonly used for this. Also, there's <tr> inside tables, which
does a bit more than just a line break.
If you output your text with header("Content-Type: text/plain")
(read the documentation about how to use this: HTTP headers have
to come *before* any text sent to the browser. Even a single space
or newline.) or otherwise get the web server to call it a plain
text file rather than HTML, newlines will be visible.
|
|
|