kstyrvoll Posted January 11, 2007 Share Posted January 11, 2007 Please excuse me for this question, but ..I have made a blog, everything is working as expected exept displaying of articles I have posted.When I make a new article, I use carriage return(enter) and format the article into several sections:Example:-startThis is a little problem.Please help.-endBut when I displays the article on my blog, it is "densed" together:-startThis is a little problem. Please help.-endWhen I open the article for editing, the formatting is correct.Sorry for not posting any code, but I don't have access to my pc or my isp from where I'm sitting right now.Thanks in advance.Kristian Link to comment https://forums.phpfreaks.com/topic/33706-trying-to-make-a-blog/ Share on other sites More sharing options...
lucasl Posted January 11, 2007 Share Posted January 11, 2007 Sounds like you aren't putting "\n" between sections.EG.[code=php:0]//Instead of:<$phpecho "$section1$section2";?>Consider:<$phpecho "$section1\n$section2";?> Link to comment https://forums.phpfreaks.com/topic/33706-trying-to-make-a-blog/#findComment-158066 Share on other sites More sharing options...
chronister Posted January 11, 2007 Share Posted January 11, 2007 nl2br($_POST['your text field']);This is new line 2 break. It will automatically insert a <br> tag into the date wherever it finds a new line.nate Link to comment https://forums.phpfreaks.com/topic/33706-trying-to-make-a-blog/#findComment-158067 Share on other sites More sharing options...
chronister Posted January 11, 2007 Share Posted January 11, 2007 [quote]nl2br($_POST['your text field']);This is new line 2 break. It will automatically insert a[code] <br /> [/code]tag into the date wherever it finds a new line (carriage return).nate[/quote]They have cut down the modify time, so I could not fix a couple things I wanted.You then would reverse it with a [code]str_replace('<br />', '\n', $your_text_var_name)[/code] Link to comment https://forums.phpfreaks.com/topic/33706-trying-to-make-a-blog/#findComment-158068 Share on other sites More sharing options...
kstyrvoll Posted January 11, 2007 Author Share Posted January 11, 2007 thanks!!nl2br(... did it. Link to comment https://forums.phpfreaks.com/topic/33706-trying-to-make-a-blog/#findComment-158364 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.