Boxerman Posted September 10, 2015 Share Posted September 10, 2015 Hey guys, I have a news site, but when people input everything, it displays it all as one line. How can I automatically format the news? Like adding stuff for quotes and codes and paragraphs etc? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/298118-formatting-mysql-output-in-php/ Share on other sites More sharing options...
Ch0cu3r Posted September 10, 2015 Share Posted September 10, 2015 it displays it all as one line. Its is because web browsers do not display whitespace characters such as newlines. What you need to is conver the newlines into a HTML break tags <br /> PHP has a function that can do this for you called nl2br. Use this when you echo your post. How can I automatically format the news? Like adding stuff for quotes and codes and paragraphs etc? To format the text of your post you can either use bbcodes/markdown, or implement a WYSIWYG type editor, such as CKeditor Quote Link to comment https://forums.phpfreaks.com/topic/298118-formatting-mysql-output-in-php/#findComment-1520612 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.