Recent Posts
- Quick Code: Get the domain name in JS
- Things to think about when designing a logo
- Javascript Array Functions
- Integrating FCKEditor to save current content with AJAX using PHP
- Pad A Javascript Number
- Why use heading tags as opposed to font tags for displaying text in HTML?
- Creating One Time Download Links
- Why Javascript in Forms is Bad
- Five Things To Remember When Designing Accessible Web Pages
- Sizing Images Correctly – Part Two
Topics
Integrating FCKEditor to save current content with AJAX using PHP
Posted on 27th March 2009 by Jacob
This is a short post which basically looks at an issue I had whilst developing my own content management system in PHP. The system uses FCKEditor as a basis in which for users to edit content with. The problem stemmed from me wanting an auto save feature that saved what was currently within the FCKEditor window. As I wanted the auto save to work on a timed basis as well it working without reloading the page i used AJAX ito help with this. The key line for getting the current content from the FCKEditor into a variable that could then be stored within a database was:-
var VariableName = escape(FCKeditorAPI.GetInstance('FCKEditorFieldName').GetXHTML());
Basically you just need to change the ‘FCKEditorFieldName’ to what you have FCKEditor already set to yet this then pulled the data so that i execute it later within the AJAX script.
Further Reading
Have Your Say
Comments
-
Jacob on 17th April 2009 wrote:
@miles – Yeah give us a day or two and we will get some example code done and uploaded.
-
cfaria on 1st June 2009 wrote:
where is the example code
i have 3 files
newsletter
newslettervar.php
newsletter.jsif i do not use fkeditor the file make the save fun but when i put :
BasePath = $fckeditor_path;
$oFCKeditor->ToolbarSet= ‘web2009′;$oFCKeditor->Value = $descreve;
$oFCKeditor->Height = ’400′;
$oFCKeditor->Width = ’600′;
$oFCKeditor->Create();
?>
the save don“t work
Miles on 17th April 2009 wrote:
HI,
Do you have an example of this project. Would love to reproduce this. Sample code? When I viewed your other blog posts you had much more provided on the subject.
Thanks!