Re: Including Text File in PHP/HTML Template
Steve Keller <skeller <at> healthtvchannel.org>
2002-09-30 23:41:01 GMT
At 9/30/2002 04:39 AM, Rick Beckman wrote:
>On line "6", I have the list of musicians in the song.
>Example (ignore the quotes): "Doyle Lawson -- lead vocal; Dale Perry -- bass
>Is there a way to make it so that, when I include line 6 in my PHP template,
>the ";" will be replaced with a line break so I get one musician per line in
>the HTML output?
$line6 = str_replace(";", "\n", $line6);
If you're talking about HTML line breaks, just substitute <br /> for \n.
>Lines 7 and so on are the lyrics. The text file has one line per line (makes
>sense, right?) and a blank line between sections of the song. I have the
>script set up to read all the lines from 7 on, but it jumbles them all
>together, ignoring the line breaks. Is there a way to script PHP to add the
>line breaks, or should the line break HTML just be inserted everywhere
>needed in all my separate files?
Where is this jumbling that you're talking about, in your HTML display?
HTML browsers don't recognize line-break escape characters. Yes, you would
need <br /> if you want it to display in HTML. As far as the browser's
concerned, there's no difference between HTML served cold and HTML
generated by PHP.
The Health TV Channel, Inc.