geoldr Posted July 24, 2008 Share Posted July 24, 2008 Hello all, so I have a question. I have programmed a application which let's registered users on my website store create text documents online. Everything is finished and works great. When you make a new document it displays its title and its linked to the page where if you click you can read the actual document. Just like a forum post. Anyways, here's the problem. I am using < pre > tags to save my formatting. Some users like to put spaces, and I myself like to make multiple paragraph breaks. Well, with the < pre > tag, if a user posts one long sentence, the sentence comes off my page!! If I don't use the < pre > tag, then everything looks good, but there is no formatting. Of course, I know I can replace the ' ' with an "nbsp" and a line break with a < br > tag, but heres why I don't want to do that. If a user wants to edit a page, it takes them back to the same dialog and inputs their information into the text fields. If my program were to replace everything, their document would have all sorts of HTML code in it! And I don't want that. So my question is, how do I get passed this? This is very important, and I can't seem to find a solution. How do all forum pages do it? And if you go to the forum post edit page, there is no HTML code, so theres obviously a way to do it, but how?! Quote Link to comment https://forums.phpfreaks.com/topic/116360-problem-with-formatting/ Share on other sites More sharing options...
haku Posted July 24, 2008 Share Posted July 24, 2008 Use a script to change all your linebreaks into < br /> upon save, and to \n upon reload. Quote Link to comment https://forums.phpfreaks.com/topic/116360-problem-with-formatting/#findComment-598332 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.