Call-911 Posted January 19, 2011 Share Posted January 19, 2011 Hey All, I've tried everything... How can I add nl2br to this, so it fix's quotes and does nl2br. <tr> <td width='200px' valign='top'>Course Overview: </td> <td valign='top'> " . fixQuotes($row['overview']) . "</td> </tr> Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 19, 2011 Share Posted January 19, 2011 Is the above already being echoed from within php or not? Quote Link to comment Share on other sites More sharing options...
coupe-r Posted January 19, 2011 Share Posted January 19, 2011 Just add this above your code $newVar = nl2br($row['overview']); Then you would have fixQuotes($newVar) Quote Link to comment Share on other sites More sharing options...
Call-911 Posted January 20, 2011 Author Share Posted January 20, 2011 Yes, the above is being echo'd by php. The script works fine, but I need to add nl2br because it's not showing line breaks. ie, if it's stored in the database as: testing sentence one. testing sentence two. It's displayed as: testing sentence one.testing sentence two. coupe-r's solution didn't work. Not sure why not... in theory it looks like it would work, but the row "overview" wouldn't display when I tried that. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 20, 2011 Share Posted January 20, 2011 What is in the fixQuotes() function? Quote Link to comment Share on other sites More sharing options...
Call-911 Posted January 20, 2011 Author Share Posted January 20, 2011 My functions.php file that I include. <?php function fixQuotes($filterString) { RETURN str_replace(chr(133),"...", str_replace(chr(241),"ñ", str_replace(chr(150),"-", str_replace(chr(145),"'", str_replace(chr(146),"'", str_replace(chr(146),"'", str_replace(chr(147),"\"", str_replace(chr(148),"\"", str_replace(chr(133),"©", str_replace(chr(198),"'", str_replace(chr(246),"", str_replace(chr(244),"", $filterString)))))))))))); } function shortVersion($condense) { RETURN substr($condense,0,stripos($condense,"<br")); } function shortVersion2($condense2) { RETURN substr($condense2,0,stripos($condense2,"\r\n")); } function nodoublespace($removespace) { RETURN str_replace(" ","",$removespace); } function single_quote($replacequote) { RETURN str_replace("'","'",$replacequote); } Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted January 20, 2011 Share Posted January 20, 2011 As long as the code you posted above was working to begin with, this should take care of it. <tr> <td width='200px' valign='top'>Course Overview: </td> <td valign='top'> " . nl2br(fixQuotes($row['overview'])) . "</td> </tr> Quote Link to comment Share on other sites More sharing options...
Call-911 Posted January 20, 2011 Author Share Posted January 20, 2011 I could of sworn I did exactly that, but what you did worked. I must of messed up a character somewhere. Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.