public function replace($id, $config = array(), $events = array())
	{
		$out = "";
		if (!$this->initialized) {
			$out .= $this->init();
		}

		$_config = $this->configSettings($config, $events);

		$js = $this->returnGlobalEvents();
		if (!empty($_config)) {
			$js .= "CKEDITOR.replace('".$id."', ".$this->jsEncode($_config).");";
		}
		else {
			$js .= "CKEDITOR.replace('".$id."');";
		}
		$out .= $this->script($js);

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

		return $out;
	}
public function replace($id, $config = array(), $events = array())
	{
		$out = "";
		if (!$this->initialized) {
			$out .= $this->init();
		}

		$_config = $this->configSettings($config, $events);

		$js = $this->returnGlobalEvents();
		if (!empty($_config)) {
			$js .= "CKEDITOR.replace('".$id."', ".$this->jsEncode($_config).");";
		}
		else {
			$js .= "CKEDITOR.replace('".$id."');";
		}
		$out .= $this->script($js);

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

		return $out;
	}
public function replace ( $ id , $ config = array ( ) , $ events = array ( ) ) { $ out = "" ; if ( ! $ this -> initialized ) { $ out .= $ this -> init ( ) ; } $ _config = $ this -> configSettings ( $ config , $ events ) ; $ js = $ this -> returnGlobalEvents ( ) ; if ( ! empty ( $ _config ) ) { $ js .= "CKEDITOR.replace('" . $ id . "', " . $ this -> jsEncode ( $ _config ) . ");" ; } else { $ js .= "CKEDITOR.replace('" . $ id . "');" ; } $ out .= $ this -> script ( $ js ) ; if ( ! $ this -> returnOutput ) { print $ out ; $ out = "" ; } return $ out ; }
Replaces a &lt;textarea&gt; with a %CKEditor instance.

@param $id (string) The id or name of textarea element.
@param $config (array) The specific configurations to apply to this editor instance (optional).
@param $events (array) Event listeners for this editor instance (optional).

Example 1: adding %CKEditor to &lt;textarea name="article"&gt;&lt;/textarea&gt; element:
@code
$CKEditor = new CKEditor();
$CKEditor->replace("article");
@endcode
Replaces a &lt ; textarea&gt ; with a %CKEditor instance .