RE: [PHP] formatting textarea input on output
| From: | daniel | Date: | Tue, 25 Mar 2003 22:37:31 +0000 |
| Subject: | RE: [PHP] formatting textarea input on output | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-141031@lists.php.net to get a copy of this message | ||
/**
* converts line break and spaces to page break
*
* @access public
*/
function nlbr($string) {
return preg_replace("/(\r\n|\n|\r)/", "<br>\n", $string);
}
here is one i use , what i'm still trying to work out , its a way to splita
long peice of content into a preview caption with a more link , my current
code will break say if there was a G.W Bush , as it soughta gets the first .
but need a way to get the first "." plus a \n
so efwerui.
qwroirwjoiwrj
is consider a new sentence so will only show efwerui. any ideas ?
>===== Original Message From Charles Kline <ckline@rightcode.net> =====
>hi all,
>
>i have a textarea in a form which gets inserted into a table in my
>database (mySQL). When displaying this text back to the screen, how do
>i retain the line breaks etc. that were in the original input?
>
>thanks
>charles
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php