I was able to get the Javascript version of the editor working on a simple test page, but, as soon as I moved that working code over to a PHP page, the editor now won't load at all on my page. Here's the relevant code:
<script type="text/javascript" src="/tools/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( 'content', 400, 250 ) ;
oFCKeditor.BasePath = "/tools/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>
Then later in the page, this is my textarea field that I want the editor to attach to...
If I used the above code in a plain HTML file, it works. If I used it in my PHP file, it doesn't work. Am I missing something?
Also, I noticed that in IE 6.x on PC, you can only click in the top part of the input box that fckedit draws to start typing in the field. If you click in any other place in the empty field, the cursor disappears and the field loses focus. This doesn't happen if th field is full, but, for entering new items into a blank field, I found this a bit frustrating until I figure out that it will only respond if you click in the first line of the empty field. In Netscape, it works as it should - if I click anywhere in the empty textarea field, it gets focus and the cursor appears.
<script type="text/javascript" src="/tools/fckeditor.js"></script>
<script type="text/javascript">
window.onload = function()
{
var oFCKeditor = new FCKeditor( 'content', 400, 250 ) ;
oFCKeditor.BasePath = "/tools/" ;
oFCKeditor.ReplaceTextarea() ;
}
</script>
Then later in the page, this is my textarea field that I want the editor to attach to...
<textarea id="content" name="content" cols="35" rows="10"><? echo $content;?></textarea>
If I used the above code in a plain HTML file, it works. If I used it in my PHP file, it doesn't work. Am I missing something?
Also, I noticed that in IE 6.x on PC, you can only click in the top part of the input box that fckedit draws to start typing in the field. If you click in any other place in the empty field, the cursor disappears and the field loses focus. This doesn't happen if th field is full, but, for entering new items into a blank field, I found this a bit frustrating until I figure out that it will only respond if you click in the first line of the empty field. In Netscape, it works as it should - if I click anywhere in the empty textarea field, it gets focus and the cursor appears.
RE: 2.0 - Won't Work in PHP Scripts
RE: 2.0 - Won't Work in PHP Scripts
I haven't used the 2.0 beta but the 1.6 version works great. And I use it with PHP and ASP.net. If you are using the javascript implementation of it then it really really really doesn't matter if you use that on a php page or ANY other type of page.
I would say that you have some problem with your javascript.
Since there is an extreme lack of documentation for this project you would be better off to find a different editor if you are unable to deal with finding your own solution to your coding errors.
RE: 2.0 - Won't Work in PHP Scripts
RE: 2.0 - Won't Work in PHP Scripts
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'page_desc' ) ;
oFCKeditor.Width = "100%" ;
oFCKeditor.Height = 300 ;
oFCKeditor.ToolbarSet = "Default" ;
oFCKeditor.Value = "<?=addslashes(stripslashes($_REQUEST['page_desc']))?>" ;
oFCKeditor.BasePath = "<?=DIR_WS_SCRIPTS?>" ;
oFCKeditor.CheckBrowser = true ;
oFCKeditor.Create() ;
</script>
You have to remember that you're escaping for the JavaScript as well as the html. It's found that with Magic Quotes on, this always seems to work.
Note, don't use "description" or "desc" as your textarea name. "description" confused JavaScript and "desc" confuses MySQL.
Cheers,
Jeff
RE: 2.0 - Won't Work in PHP Scripts
Stephan, you can't apply the PHP htmlentities() function to any of the text because if you do, you'll turn all the brakets around the HTML tags that FCK creates into < or >. That effectively breaks all of the HTML tags and is NOT the desired result. So this <b> turns into this: <b>
Jeff, the way you suggested implementing FCK is working with PHP, the ReplaceTextArea thing doesn't seem to work at all for me on a PHP page (I'm using 1.6). But the above does work. But, I'm not sure why you are stripping the slashes then adding them right back, though. I'm not having a problem with quotes in 1.6, it was 2.0 that doesn't turned them into an html entity and screws everything up.
But, now I'm finding strange characters in the text if someone pastes in text from a word file that uses the typographic quote marks. It seems FCK doesn't know how to turn these characters into their HTML equivalents, so, it's turning into gobbeldygook.