gordon.c Posted April 12, 2009 Share Posted April 12, 2009 hi I am building a wysiwyg edit but I cant find how to detect an enter in textarea using php? thx for help Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/ Share on other sites More sharing options...
jackpf Posted April 12, 2009 Share Posted April 12, 2009 PHP is server-side. I think this task is best suited for javascript. Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/#findComment-808077 Share on other sites More sharing options...
Axeia Posted April 12, 2009 Share Posted April 12, 2009 A wyiswyg editor would be (almost fully) javascript clientside based. To detect key events you need to attach a key event listener to either the textarea or the document. Hope you know what you're getting yourself into, creating a editor is painstaking work.. more so if you want it to be functional crossbrowser. I'd make sure to see if someone else hasn't already done what you're trying to do.. unless you're looking for a challenge. Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/#findComment-808096 Share on other sites More sharing options...
jackpf Posted April 12, 2009 Share Posted April 12, 2009 Yeah lol. It took me bloody ages just to try and get textareas in the forum I made to allow the tab button. And it still only works in Firefox Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/#findComment-808099 Share on other sites More sharing options...
gordon.c Posted April 12, 2009 Author Share Posted April 12, 2009 Lets takes this forum as an example. This does not use javascript for detecting enter. It is certainly PHP taking place. What is it in actual. I would rather stick with PHP, however thx for the javascript advices. Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/#findComment-808188 Share on other sites More sharing options...
jackpf Posted April 12, 2009 Share Posted April 12, 2009 No, seriously, PHP can't do this. And where on this forum does "PHP" detect the return key? Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/#findComment-808190 Share on other sites More sharing options...
premiso Posted April 12, 2009 Share Posted April 12, 2009 nl2br is what I believe the OP is getting at. It converts the new line characters to the HTML <br> so when printed on a page it shows the new lines. Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/#findComment-808191 Share on other sites More sharing options...
jackpf Posted April 12, 2009 Share Posted April 12, 2009 Ooooh right, yeah. That is all processed when the form is submitted. However, you would not be able to do it like this with a text editor unless you used ajax. Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/#findComment-808194 Share on other sites More sharing options...
premiso Posted April 12, 2009 Share Posted April 12, 2009 Ooooh right, yeah. That is all processed when the form is submitted. However, you would not be able to do it like this with a text editor unless you used ajax. Given that he has been very vague, a vague answer is given. I am not to presume everything the OP wants just on assumption. You know what assuming does right? It makes an ass out of u and me. If he wants a better answer he needs to be more descriptive as to what he wants and show some code. Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/#findComment-808195 Share on other sites More sharing options...
gordon.c Posted April 13, 2009 Author Share Posted April 13, 2009 nl2br is what I believe the OP is getting at. It converts the new line characters to the HTML <br> so when printed on a page it shows the new lines. Yes that is absolutely what I am looking for... So whats the secret? Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/#findComment-808884 Share on other sites More sharing options...
jackpf Posted April 13, 2009 Share Posted April 13, 2009 Premiso, I'm starting to agree. Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/#findComment-808889 Share on other sites More sharing options...
laffin Posted April 13, 2009 Share Posted April 13, 2009 $return=strpos($string,"\n"); is how u detect newlines within a textarea. u can also use explode to get the lines into an array $lines=explode("\n",$string); Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/#findComment-808893 Share on other sites More sharing options...
gordon.c Posted April 13, 2009 Author Share Posted April 13, 2009 Thank you very much for help all problem solved Quote Link to comment https://forums.phpfreaks.com/topic/153757-solved-own-wysiwyg-editor/#findComment-808915 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.