CKEditor Sample — Replace Selected Textarea Elements Using PHP Code

This sample shows how to replace a selected <textarea> element with a CKEditor instance by using PHP code.

To replace a <textarea> element, place the following call at any point after the <textarea> element:

// Include the CKEditor class.
include_once "ckeditor/ckeditor.php";

// Create a class instance.
$CKEditor = new CKEditor();

// Path to the CKEditor directory.
$CKEditor->basePath = '/ckeditor/';

// Replace a textarea element with an id (or name) of "textarea_id".

Note that textarea_id in the code above is the id attribute of the <textarea> element to be replaced.