Re: PHP Include Help

From: Date: Tue, 01 Oct 2002 06:51:06 +0000
Subject: Re: PHP Include Help
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118323@lists.php.net to get a copy of this message
> 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? You could use str_replace on the line you've just read... http://www.php.net/str_replace > 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? Use nl2br: http://www.php.net/nl2br This function replaces all "\n" (newlines) with "<BR>\n" (HTML break with newline) HTH Erwin

« previous php.general (#118323) next »