nl2p() functions Author: Ingus Rukis, http://www.wisecms.com, ingus.rukis@gmail.com More instructions and demostration on how these functions work can be found in the index.php file. Please copy the index.php file to any place where you can execute PHP files and access it through your browser. If you are looking for the source only, you can find it below: tags $text = '

' . $text . '

'; // replace all newline characters with paragraph ending and starting tags $text = str_replace("\n",'

',$text); // remove any cariage return characters $text = str_replace("\r",'',$text); // remove empty paragraph tags $text = str_replace('

','',$text); // optional replacement, if you need a nice-looking XHTML source and not all source in one line. $text = str_replace('

', "

\n

", $text); return $text; } // the same PHP class, just added a CSS class functionality - you can also pass a CSS class that you want your paragraphs to use. function nl2p_css($text, $cssClass=''){ // put all text into

tags, adding the passed CSS class $text = '

' . $text . '

'; // replace all newline characters with paragraph ending and starting tags $text = str_replace("\n",'

',$text); // remove any cariage return characters $text = str_replace("\r",'',$text); // remove empty paragraph tags $text = str_replace('

','',$text); // optional replacement, if you need a nice-looking XHTML source and not all source in one line. $text = str_replace('

', "

\n

", $text); return $text; } ?>