Rommeo Posted December 22, 2008 Share Posted December 22, 2008 Hello i m trying to build my own blog. I am almost done. But the problem is, i designed a blog-enty-page, and when i write at textarea and post it ( cause there is no "<br>" tags when i press enter for the newline, ) it does not seem good and everytime i open the post and add all tags manually. But at wordpress ( and here when i m posting this entry ) when you enter it automatically adds br tag to the text. How can i do it ? Do they use javascript ? Is there any free-to-use panels on web ? How do you solve this problem ? I m sure when you post something you have to add some tags for br or italic etc. Thank you in advance for your answer. Quote Link to comment https://forums.phpfreaks.com/topic/137976-solved-how-do-you-do-this/ Share on other sites More sharing options...
JasonLewis Posted December 22, 2008 Share Posted December 22, 2008 Don't worry about any JavaScript. What your doing is fine, all it's doing is storing it as a \n or \r\n depending on the OS. All you need to do is retrieve the text from SQL and use the nl2br function to convert all new line characters to line breaks. Quote Link to comment https://forums.phpfreaks.com/topic/137976-solved-how-do-you-do-this/#findComment-721146 Share on other sites More sharing options...
Rommeo Posted December 22, 2008 Author Share Posted December 22, 2008 Don't worry about any JavaScript. What your doing is fine, all it's doing is storing it as a \n or \r\n depending on the OS. All you need to do is retrieve the text from SQL and use the nl2br function to convert all new line characters to line breaks. Thank you for your reply ProjectFear But then, I think I should write "\n or \r\n" instead of "<br>" while posting the entry ?? And i want to use "italic" "bold" etc. ? At that time can i use them ? Quote Link to comment https://forums.phpfreaks.com/topic/137976-solved-how-do-you-do-this/#findComment-721150 Share on other sites More sharing options...
Lamez Posted December 22, 2008 Share Posted December 22, 2008 you need to look into BBCODE, there are plenty of good scripts out there. Quote Link to comment https://forums.phpfreaks.com/topic/137976-solved-how-do-you-do-this/#findComment-721170 Share on other sites More sharing options...
JasonLewis Posted December 22, 2008 Share Posted December 22, 2008 Yes, look into bbcode for STYLING the text but as for new lines. If they hit enter in a text area field and then submit that data and you store it in a MySQL table, then when you retrieve that value back from the table all you need is nl2br. For other tags, such as italic you can look at simple str_replace tutorials. Quote Link to comment https://forums.phpfreaks.com/topic/137976-solved-how-do-you-do-this/#findComment-721180 Share on other sites More sharing options...
Rommeo Posted December 22, 2008 Author Share Posted December 22, 2008 i got the bbcode part but how can i do that like WYSIWYG style. I mean I want to make the text bold when the user select the text and click the "make it bold" button. I think i need to learn some javascript, dont i ? Or can i find ready-to-use script ? How do you solve this problem ? Do you code it yourself ? Quote Link to comment https://forums.phpfreaks.com/topic/137976-solved-how-do-you-do-this/#findComment-721261 Share on other sites More sharing options...
Mark Baker Posted December 22, 2008 Share Posted December 22, 2008 i got the bbcode part but how can i do that like WYSIWYG style. I mean I want to make the text bold when the user select the text and click the "make it bold" button. I think i need to learn some javascript, dont i ? Or can i find ready-to-use script ? How do you solve this problem ? Do you code it yourself ? For a WYSIWYG editor, take a look at FckEdit or TinyMCE Quote Link to comment https://forums.phpfreaks.com/topic/137976-solved-how-do-you-do-this/#findComment-721267 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.