Opened 13 years ago
Closed 13 years ago
#8965 closed Bug (expired)
creating ckeditor via PHP through AJAX to load an error
Reported by: | Alexsandr | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | Server : PHP | Version: | |
Keywords: | Cc: |
Description
creating ckeditor via PHP through AJAX to load an error propose the following fix fix to the file "fckeditor_php5.php" function editor
public function editor($name, $value = "", $config = array(), $events = array()) { $attr = ""; foreach ($this->textareaAttributes as $key => $val) { $attr.= " " . $key . '="' . str_replace('"', '"', $val) . '"'; } $out = "<textarea name=\"" . $name . "\"" . $attr . ">" . htmlspecialchars($value) . "</textarea>\n"; if (!$this->initialized) { $out .= $this->init(); } $_config = $this->configSettings($config, $events); $js = $this->returnGlobalEvents(); //FIX $js .= " if (CKEDITOR.instances['".$name."']) {"; $js .= " delete CKEDITOR.instances['".$name."'];"; $js .= "}"; if (!empty($_config)) $js .= "CKEDITOR.replace('".$name."', ".$this->jsEncode($_config).");"; else $js .= "CKEDITOR.replace('".$name."');"; $out .= $this->script($js); if (!$this->returnOutput) { print $out; $out = ""; } return $out; }
Change History (2)
comment:1 Changed 13 years ago by
Status: | new → pending |
---|---|
Version: | 3.6.3 |
comment:2 Changed 13 years ago by
Resolution: | → expired |
---|---|
Status: | pending → closed |
First of all we think that if you are creating CKEditor through AJAX (which is JavaScript) you should use only JavaScript method (it's better) and not PHP integration.
Second I have noticed that you are creating CKEditor but you don't use destroy() method. If you are creating instance, don't destroy it and then try to create is again you will get error saying that instance already exists. Please see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#destroy and how it works can be seen in http://nightly.ckeditor.com/7484/_samples/ajax.html.[[BR]] Was this the source of your problem? Please leave a comment.
I see the fix but you haven't sent us the code that was causing problems. Could you send us your sample (HTML page or HTML Page and PHP script) so that we could see the problem on our own?
Please bear in mind that the most important part in bug reporting is sending working code that is causing problems. Fix without the problem is not enough.