Re: Including Text File in PHP/HTML Template

From: Date: Mon, 30 Sep 2002 23:41:01 +0000
Subject: Re: Including Text File in PHP/HTML Template
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118274@lists.php.net to get a copy of this message
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 vocal" 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. -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: skeller@healthtvchannel.org Web: www.healthtvchannel.org

« previous php.general (#118274) next »