Re: Convert plain text to HTML tagged text

From: Date: Wed, 29 Sep 2004 17:55:31 +0000
Subject: Re: Convert plain text to HTML tagged text
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-36451@lists.php.net to get a copy of this message
if the returnns are "\n" you only need nl2br("this \n test \n")... or preg_replace("/((\r|\n)|(\r\n|\n\r))/", "<br />", "this \r\n test \r\n")... good luck... <veditio@comcast.net> escribió en el mensaje news:092820041715.29949.41599C2B000C6CAD000074FD22007511509B020103040A0B@com cast.net... > To the list: > > I've googled and searched the manual, but I'm still looking for a simple solution to a simple problem. > > I have a MySQL database of text stories in longtext MySQL fields. These stories have simple returns (\r) in them and no other formatting. I need to use these stories both for web and print production, so I need to be able to get the text out of MySQL via PHP and have those returns change to <P> tags. But I also need to keep those extra <P> tags out of the database file so the text can be exported and poured into a layout program. > > HTMLspecialchars and HTMLentities don't seem like the right solution, but maybe I'm missing something. Do I have to use regular expressions in PHP as the text is pulled from the database? > > Thanks in advance for your help. > > --veditio

« previous php.db (#36451) next »