Hello,
I try FCKeditor for my pages (http://zlatylist.org), but I have primitive problem...
Source:
<script type=\"text/javascript\"> <!-- // Automatically calculates the editor base path based on the _samples directory. // This is usefull only for these samples. A real application should use something like this: // oFCKeditor.BasePath = '/fckeditor/' ; // '/fckeditor/' is the default value. var oFCKeditor = new FCKeditor( 'content' ) ; oFCKeditor.BasePath = 'ukazky/nic/fckeditor/' ; oFCKeditor.Height = 500 ; oFCKeditor.Value = '$content_textarea' ; oFCKeditor.Create() ; //--> </script>
and in variable "$content_textarea" i have content of page.. but problem is with javascript when there is new line (\n)
for example:
<?php $content_textarea="aaaaaaaaaaaa bbbbbbbbbbbb cccccc"; ?> ............ ...... oFCKeditor.Value = '$content_textarea' ; ......
Javascript doesnt support it:
oFCKeditor.Value = 'aaaaaaaaaaaa bbbbbbbbbbbb cccccc' ;
it wants
oFCKeditor.Value = 'aaaaaaaaaaaa' +'bbbbbbbbbbbb' +'cccccc' ;
or better:
oFCKeditor.Value = 'aaaaaaaaaaaa<br />bbbbbbbbbbbb<br />cccccc' ;
How i can fix it?
If I use str_replace in php it isnt work..:
$content_textarea = Str_Replace("\n", "<br />", $content_textarea); ........ oFCKeditor.Value = 'aaaaaaaaaaaa <br />bbbbbbbbbbbb <br />cccccc' ; ...
//by the way.. i cant use fceditor in php, i probably need only js.
Can you help me please?
Thanks!
Re: Can I fix \n in jscript?
You could maybe try something like (in PHP, before you print it out)...
however there is little point to this as you could just use
in your php file, then you wouldn't have to worry about the new line error.
Hope this helps
Re: Can I fix \n in jscript?
Thanks!! It works
I forgot "\r"