Frylock
asked on
FCKeditor problem with value property that has quotes, apostrophes
I need the value property to be able to display content that has both single (apostrophe - ' ) and double qoutes - " ).
What I am doing is echoing from php into value property content that includes both ' and ".
However, the java gets escaped from with the ' or the " depending on which one I use to set the oFCKeditor.Value.
' causes problems with
oFCKeditor.Value = 'My ring's on my finger' ;
The " causes problems with
oFCKeditor.Value = '<font size="2">hi</font>";
Any help would be appreciated. I did a search and could not find any other answers to this.
What I am doing is echoing from php into value property content that includes both ' and ".
However, the java gets escaped from with the ' or the " depending on which one I use to set the oFCKeditor.Value.
' causes problems with
oFCKeditor.Value = 'My ring's on my finger' ;
The " causes problems with
oFCKeditor.Value = '<font size="2">hi</font>";
Any help would be appreciated. I did a search and could not find any other answers to this.
try this
oFCKeditor.Value ="My ring's on my finger";
oFCKeditor.Value = '<font size="2">hi</font>';
oFCKeditor.Value ="My ring's on my finger";
oFCKeditor.Value = '<font size="2">hi</font>';
ASKER
Hi,
The problem is that the value property is being pulled from a db and is being echoed. EG:
The var_text = <font="2">My Mom's ring is in the box.</font>
Now, when I echo that into the value this way:
oFCKeditor.Value = "<? echo $var_text ; ?>" ;
The server sends:
oFCKeditor.Value = "<font="2">My Mom's ring is in the box.</font>";
Swapping the " for a ' doesn't help because both are used in the string.
The problem is that the value property is being pulled from a db and is being echoed. EG:
The var_text = <font="2">My Mom's ring is in the box.</font>
Now, when I echo that into the value this way:
oFCKeditor.Value = "<? echo $var_text ; ?>" ;
The server sends:
oFCKeditor.Value = "<font="2">My Mom's ring is in the box.</font>";
Swapping the " for a ' doesn't help because both are used in the string.
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I put in the 'addslashes' to the echo'd variable, but it is still tripping up on it.
Here is what the source of the page shows:
oFCKeditor.Value = '<p>He said to the woman, "Who is your favorite singer?"</p><p>She responded, after looking at her mother\'s watch, "Shirley Manson\'s voice is spectacular." </p>' ;
It is still being broken.
ASKER
HEy Virmajor - it's the line break that is killing it now.There are two or three of them and the line breaks kill it. How can I get rid of them?
str_replace("\n",'\n',$you rstring)
alternately: str_replace("\n",'<br />',$youstring);
(the former will cause JavaScript to reinterpolate the line breaks, the latter will cause the same effective appearance).
alternately: str_replace("\n",'<br />',$youstring);
(the former will cause JavaScript to reinterpolate the line breaks, the latter will cause the same effective appearance).
oFCKeditor.Value = "My ring\'\s on my finger";
oFCKeditor.Value = "<font size='2'>hi</font>";