[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    Re: [PHP] Including Text File in PHP/HTML Template
From:       Steve Keller <skeller () healthtvchannel ! org>
Date:       2002-09-30 23:41:01
[Download RAW message or body]

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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic