dnenb Posted October 4, 2013 Posted October 4, 2013 Hey guys, I have a quesiton about the formatting of posts in the mccode v2 forum. It looks like the posts are stored without any newlines in the database, and I'm not sure they're being removed. Is it the magic-quotes codeblock in globals.php? My problem is this: A player writes a post like this blablabla blabla bla But when reading the post in the forum it looks like blablabla blabla bla Quote
Dayo Posted October 4, 2013 Posted October 4, 2013 when out puting the text do it like this echo nl2br($database['text']); Quote
dnenb Posted October 4, 2013 Author Posted October 4, 2013 when out puting the text do it like this echo nl2br($database['text']); Doesn't work as there doesn't seem to be any \n's (or similar) in what's inputted into the db. Quote
KyleMassacre Posted October 4, 2013 Posted October 4, 2013 have you thought of a wysiwyg editor? Quote
KyleMassacre Posted October 4, 2013 Posted October 4, 2013 Nah I haven't. Suggestions? Yeah. Use one :p There is on that's plug and play pretty much. at tinymce.com Quote
Dayo Posted October 4, 2013 Posted October 4, 2013 i have used http://nicedit.com/ in the past but it outputs html so not so good for forums Quote
Script47 Posted October 4, 2013 Posted October 4, 2013 This is just a thought, maybe the output is being trimmed? Quote
Dave Posted October 4, 2013 Posted October 4, 2013 have you thought of a wysiwyg editor? Remember you'll still need to sanitize the text before you start passing it into your database. Quote
dnenb Posted October 4, 2013 Author Posted October 4, 2013 I will look at a wysiwyg-editor, but I have a feeling that will come with problems for some of my mobile players. As for my original question: Do any of you know why I'm not getting the newlines into the db? Is it the magic-quotes in globals.php? This is just a thought, maybe the output is being trimmed? Where do you mean? I think whatever the user inputs goes through some function that removes newlines before it gets in my db. Quote
Script47 Posted October 4, 2013 Posted October 4, 2013 (edited) Where do you mean? I think whatever the user inputs goes through some function that removes newlines before it gets in my db. Well the trim() function removes any white spaces so that might your issue, check if you can find that. Edited October 4, 2013 by Script47 Quote
KyleMassacre Posted October 4, 2013 Posted October 4, 2013 if it is trim you can do: trim($str, "/n"); Quote
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.