This extension allows the use of CKEditor in forms. This widget uses CHtml:activeTextArea to create a text box, but also creates a CKEditor instance and then replaces the textbox with a CKEditor.
CKEditor v3.6.2 is included in the extension and is automagically published to the public assets folder with the assetManager included in Yii.
This extension was created using Yii 1.1.9, but I would expect it to run on most 1.1 frameworks.
CKEditor v3.6.2 IS INCLUDED and is published to the public assets folder with the assets manager.
Use of this extension is simple. Simply unzip the extension and place the folder inside the extensions folder
this will create a file structure as follows
/protected/extensions/ckeditor /protected/extensions/ckeditor/ECKEditor.php <- Widget Class /protected/extensions/ckeditor/ECKEdit5.php <- Standalone CKEditor Class /protected/extensions/ckeditor/assets/* <- All the asset files for CKEditor
Replace any activeTextArea
echo CHtml::activeTextArea($model,'content',array('rows'=>10, 'cols'=>70));
$this->widget('application.extensions.eckeditor.ECKEditor', array( 'model'=>$model, 'attribute'=>'content', ));
if you want to use custom configure CKEditor to suit your taste, you can send in configuration information like this.
$this->widget('application.extensions.eckeditor.ECKEditor', array( 'model'=>$model, 'attribute'=>'content', 'config' => array( 'toolbar'=>array( array( 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike' ), array( 'Image', 'Link', 'Unlink', 'Anchor' ) , ), ), ));
In the code above, a custom toolbar is created that has the Source, Bold, Italic, etc controls enabled. You can pass almost any CKEditor configuration information via the config variable. To see all of how you can configure CKEditor visit: CKEditor Developer's Guide
I am not affiliated with CKEditor in any way, I have just adapted it's use to be easily used with Yii. This is a work in progress and your ideas/support would be greatly appreciated.
Many thanks to those at CKEditor
v0.2 (Jan 23, 2012) Added the ability to set CKEditor configuration v0.1 Initial Release