danielebarchiesi@0: danielebarchiesi@0: danielebarchiesi@0: danielebarchiesi@0:
danielebarchiesi@0:danielebarchiesi@0: This sample shows how to insert a CKEditor instance with custom configuration options. danielebarchiesi@0:
danielebarchiesi@0:
danielebarchiesi@0: To set configuration options, use the config
property. To set the attributes of a <textarea>
element (which is displayed instead of CKEditor in unsupported browsers), use the textareaAttributes
property.
danielebarchiesi@0:
danielebarchiesi@0: <?php danielebarchiesi@0: // Include the CKEditor class. danielebarchiesi@0: include_once "ckeditor/ckeditor.php"; danielebarchiesi@0: danielebarchiesi@0: // Create a class instance. danielebarchiesi@0: $CKEditor = new CKEditor(); danielebarchiesi@0: danielebarchiesi@0: // Path to the CKEditor directory. danielebarchiesi@0: $CKEditor->basePath = '/ckeditor/'; danielebarchiesi@0: danielebarchiesi@0: // Set global configuration (used by every instance of CKEditor). danielebarchiesi@0: $CKEditor->config['width'] = 600; danielebarchiesi@0: danielebarchiesi@0: // Change default textarea attributes. danielebarchiesi@0: $CKEditor->textareaAttributes = array("cols" => 80, "rows" => 10); danielebarchiesi@0: danielebarchiesi@0: // The initial value to be displayed in the editor. danielebarchiesi@0: $initialValue = 'This is some sample text.'; danielebarchiesi@0: danielebarchiesi@0: // Create the first instance. danielebarchiesi@0: $CKEditor->editor("textarea_id", $initialValue); danielebarchiesi@0: ?>danielebarchiesi@0:
danielebarchiesi@0: Note that textarea_id
in the code above is the name
attribute of
danielebarchiesi@0: the <textarea>
element to be created.
danielebarchiesi@0: