This extension is used to widget uses CHtml:activeTextArea to create a textarea, and also creates a CKEditor instance and then replaces the textarea with a CKEditor.
Download CKEditor from CKEditor extension
Requirements
This extension was created using Yii 1.1.9, but I would expect it to run on most 1.1 frameworks.
Installation
Use of this extension is simple. Simply unzip the extension and place the folder inside the extensions folder :
1 | application folder/protected/extensions/ |
This will create a file structure as follows :
1 2 3 4 | /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 |
Usage in _form.php page
Replace active TextArea with bellow code :
1 2 3 4 | <?php $this->widget('application.extensions.eckeditor.ECKEditor', array( 'model'=>$model, 'attribute'=>'content', )); ?> |
if you want to use custom configuration of CKEditor, then use the bellow code :
1 2 3 4 5 6 7 8 9 10 11 | <?php $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' ) , ), ), )); ?> |
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: Php Framework, Yii