I'm trying to get ckeditor to work now for almost 2 weeks and
if one of my clients had to pay for that he would not be happy ;-)
I need the option to edit a single file. The form I have perfectly loads
and saves the content to a single file.
Full page html and as long as I don't include ckeditor, it works fine.
As soon as I invoke ckeditor, the content is still loaded correct but saving
stops working.
I think I have read all the manuals and seen the few demos. I see Ajax
functions and I guess there is a way to load a file in the editor as well as
an option to save the content. Nice as this is an editor, but I can't figure
out how to implement that.
In the demos there is no example of loading and saving content, so not
much help there. In this forum most questions have 0 replies or a single
one without solution.
The only way out I see is to find someone willing to set it up for me and I
would gladly pay for it.
My name is John and john.gamonon[at]gmail.com my email
Thanks
You shouldn't need to pay
You shouldn't need to pay anyone as long as you understand how CKEditor works.
CKEditor is just an "html textarea", it's a client side element that doesn't know anything about files, just like a textarea doesn't know where do you store the contents that you are editing at that moment.
So forget about CKEditor. Create a simple page that upon loading shows a textarea with the content that you want to edit, and when you submit that form you save it back to your server. That's very simple and you should be able to find many tutorials about how to do it in any language that you're using.
When everything is ready then add the CKEditor library and use the .replace method to use it with the textarea and you should be done.
You shouldn't need to pay
So true, so clearly I don't understand it
Yes and as it is an editor, you must get some content in it else there is nothing to edit. And after you've edited that content, you would like to save it else there was no use in edit it. So there must be some magic code somewhere that takes care of getting the content in and out. Even if it's not part of the editor, reference to- or example of getting content in and out is a must. Or it's left out by intention as one has to pay for the filebrowser.
True, and as you could have read here, I have a form that get's the content loaded and saved after edit. I have no problem whatsoever with that.
It is here that I lost you completely. What is the use of loading CKEditor 'when everything is ready' ?
I need to edit a full page html file. I can load it as meant in the CKEditor. I can edit this page as a html page, great. But the final step, saving it back to the server (yes, by my own script and not CKEdit! as it is impossible to save something with CKEdit) it fails.
There is no demo here of loading content or saving content. As this is an essential part of an editor, I am quite frustrated in having to invest so much time to get this to work.
But really I have spent enought time here and just implemented good ol' Tinymce. Gues what, it works great within 15 mins.
Thanks for you supporting reply
JohN
Yes and as it is an editor,
The usual way to use it is to fill the content in the textarea and then use call CKEditor to replace the textarea with one instance of the editor.
Then when you submit the form, the CKEditor script catches the submit event and updates the textarea with the value of the editor.
The magic code is inside CKEditor and as I said, if you do things in the normal order you get that behavior for free.
If you want to update the contents after the page has been loaded (and the editor created) or you want to read its current value, then you must use the CKEditor API, and there are also samples showing how to do it (setData and getData)
I might have failed to express myself.
I meant
1) create an "edit" page, something like this:
<form method="post" action="save">
<textarea name="content"> <% readFile("myfile") %> </textarea>
<input type="submit">
</form>
2) create the "save" page
<%
value = POST("content")
saveFile("myfile", value)
echo "Your changes have been saved"
%>
3) test that
(of course in no way I've written valid code, that's a mix of languages and pseudo-code just to get the idea, but as you can see there is no need to use any javascript or AJAX at all)
Check that everything works, that you can edit, save, that there are no problems with quotes, banned words at the server, etc... So far this are just the basics about editing a file and this is what I suggested to do first.
4) now open the "edit" page and add the ckeditor.js library and set class="ckeditor" on the textarea
5) test again, When you load that page now instead of a textarea you should get an instance of the editor with the current content of the file, and when you press submit you already have the save page ready so it should keep working now.
I'm a little surprised that you have managed to understand how it works TinyMCE so quickly when in the end it's the same concept that CKEditor, but I guess that they still take other developers more in consideration and they might provide better info for newcomers.
I've tried to complain about how CKEditor is continously dropping features like the server side integration that they used to have, and are introducing others that don't have the correct defaults for most of the people. Other people have big problems because they aren't comfortable with javascript but they state that they are too busy working on the editor and they have no time for that kind of things, so it isn't a surprise that people prefer to move away to an editor that by default works better