paulmo Posted January 26, 2009 Share Posted January 26, 2009 possible/how to style echoed table text? Link to comment Share on other sites More sharing options...
Synook Posted January 26, 2009 Share Posted January 26, 2009 You mean you want the newlines converted to breaks? nl2br().Or if you want paragraphs instead of double newlines? (Untested:) $string = preg_replace("/((\r)?\n){2,}(.*?)((\r)?\n){2,}/s", "\n<p>$3</p>\n", $string); Link to comment Share on other sites More sharing options...
jeffman Posted January 27, 2009 Share Posted January 27, 2009 Are you in PHP? For line breaks, look here: http://www.php.net/manual/en/function.nl2br.phpOtherwise it's all search-and-replace.Unless you want to put the plain text inside <pre></pre> tags. These preserve line breaks and tabs as in a plain text editor. Link to comment Share on other sites More sharing options...
paulmo Posted January 28, 2009 Author Share Posted January 28, 2009 thanks for the responses. yes i'm in php, so str_replace or regex? thanks for that regex code. use <pre> in db table text or php code? or with regex, put code after echo $row? thanks for php manual link. i'll put together something and post it here. Link to comment Share on other sites More sharing options...
Synook Posted January 31, 2009 Share Posted January 31, 2009 <pre> as a HTML tag surrounding the text will preserve newlines. Link to comment Share on other sites More sharing options...
paulmo Posted January 31, 2009 Author Share Posted January 31, 2009 tried <pre>, that seems relevant to html text already in doc. nl2br() is preserving line breaks in echoed table data! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.