Page 1 of 1

Question about WYSIWYG

Posted: Mon Aug 23, 2010 6:50 pm
by ScOrPi
Hello all ,

i wondering about making WYSIWYG reply box

is it possible to make reply box by using php ?

and what is the basics ?

if it's not possible .. how can i make new line useing text area when i insert it into table

i need to insert <br> when the member press enter key without see it ..

Re: Question about WYSIWYG

Posted: Tue Aug 24, 2010 1:24 am
by Christopher
There are a number of rich text editors. CKEditor and TinyMCE are two good and popular ones. Take a look at those.

If you want to use PHP then you need to convert "<br/>" to "\n" after you read the data, display the data in a textarea, and then convert "\n" back to "<br/>" before you save the data.

Re: Question about WYSIWYG

Posted: Tue Aug 24, 2010 8:58 am
by ScOrPi
thanks for reply ..

the question is .. how can i tell php that this is a new line if the member using textarea and he had type something like this
" Hi all

How are u

i hope u r fine "
between every line there is an empty line

if i called textarea topic then

Code: Select all

$topic = $_POST['topic']; /// that would make the topic in on line .. not in differ lines 
so how could i know that it's a new line .. and insert <br>

:banghead:

Re: Question about WYSIWYG

Posted: Tue Aug 24, 2010 3:39 pm
by jraede
If you want to use PHP then you need to convert "<br/>" to "\n" after you read the data, display the data in a textarea, and then convert "\n" back to "<br/>" before you save the data.
\n is a special character for line breaks.

Re: Question about WYSIWYG

Posted: Fri Aug 27, 2010 10:03 pm
by PHPHorizons
To be a bit more specific, what the user sees when they type into a textbox is different from the characters that are actually there. Pressing the enter key actually causes a NEW LINE character to be placed into the string: \n
But, the user only sees a new line. Therefore, you can search for \n and replace with <br>

In other words, here is what that string looks like to the computer:
" Hi all\n\nHow are u\n\ni hope u r fine "
Make sense?

Re: Question about WYSIWYG

Posted: Sat Aug 28, 2010 9:59 am
by ScOrPi
PHPHorizons wrote:To be a bit more specific, what the user sees when they type into a textbox is different from the characters that are actually there. Pressing the enter key actually causes a NEW LINE character to be placed into the string: \n
But, the user only sees a new line. Therefore, you can search for \n and replace with <br>

In other words, here is what that string looks like to the computer:
" Hi all\n\nHow are u\n\ni hope u r fine "
Make sense?
ahaa ... i got it ..

u r genius thank you so much .

Re: Question about WYSIWYG

Posted: Sat Aug 28, 2010 10:13 am
by PHPHorizons
You're welcome ;)