Opened 12 years ago

Closed 12 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:


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();

                $js .= " if (CKEDITOR.instances['".$name."']) {";
                $js .= " delete CKEDITOR.instances['".$name."'];";
                $js .= "}";

		if (!empty($_config))
			$js .= "CKEDITOR.replace('".$name."', ".$this->jsEncode($_config).");";
			$js .= "CKEDITOR.replace('".$name."');";

		$out .= $this->script($js);

		if (!$this->returnOutput) {
			print $out;
			$out = "";

		return $out;

Change History (2)

comment:1 Changed 12 years ago by Jakub Ś

Status: newpending
Version: 3.6.3

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 and how it works can be seen in[[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.

comment:2 Changed 12 years ago by Jakub Ś

Resolution: expired
Status: pendingclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy