質問

Trying to use CKEditor with Yii Framework for my textarea

I get this error

TheCKEditorWidget cannot find the view "TheCKEditorWidget

Here is my View _form.php

$this->widget('application.extensions.TheCKEditor.TheCKEditorWidget',array(
        'model'=>$model,                # Data-Model (form model)
        'attribute'=>'field',           # Attribute in the Data-Model
        'height'=>'400px',
        'width'=>'100%',
        'toolbarSet'=>'Basic',          # EXISTING(!) Toolbar (see: ckeditor.js)
        'ckeditor'=>Yii::app()->basePath.'/../ckeditor/ckeditor.php',
                                        # Path to ckeditor.php

        'ckBasePath'=>Yii::app()->baseUrl.'/ckeditor/',
                                        # Relative Path to the Editor (from Web-Root)
        'css' => Yii::app()->baseUrl.'/css/index.css',
                                        # Additional Parameters
    ) );

and what these are meant for, the following ckeditor , basepath

'ckeditor'=>Yii::app()->basePath.'/../ckeditor/ckeditor.php', # Path to ckeditor.php

'ckBasePath'=>Yii::app()->baseUrl.'/ckeditor/', # Relative Path to the Editor (from Web-Root)

'css' => Yii::app()->baseUrl.'/css/index.css',  # Additional Parameters

and below is the extension class

protected\extensions\TheCKEditor\TheCKEditorWidget.php

class TheCKEditorWidget extends CInputWidget
{
    public $ckeditor;
    public $ckBasePath;
    public $height = '375px';
    public $width = '100%';
    public $toolbarSet;
    public $config;
    public $css;

    public function run()
    {
        if (!isset($this->ckeditor)){
            throw new CHttpException(500,'Parameter "ckeditor" has to be set!');
        }
        if (!isset($this->ckBasePath)){
            throw new CHttpException(500,'Parameter "ckBasePath" has to be set!');
        }
        if (!$this->hasModel() && !isset($this->name)) {
            throw new CHttpException(500,'Parameters "model" and "attribute" or "name" have to be set!');
        }
        if (!isset($this->toolbarSet)){
            $this->toolbarSet = "Default";
        }

        $this->render('TheCKEditorWidget',array(
            'ckeditor'=>$this->ckeditor,
            'ckBasePath'=>$this->ckBasePath,
            'model'=>$this->model,
            'attribute'=>$this->attribute,
            'name'=>$this->name,
            'value'=>$this->value,
            'height'=>$this->height,
            'width'=>$this->width,
            'toolbarSet'=>$this->toolbarSet,
            'config'=>$this->config,
            'css'=>$this->css,
        ));
    }
}

When i run that particular view _form is called , I get this error

**TheCKEditorWidget cannot find the view "TheCKEditorWidget

Can someone explain the cause and solution that would be of great help.

役に立ちましたか?

解決

The extension and integration looks so bad, later i found this link and its very helpful

for integrating CKEditor with Yii

Step by Step tutorial using plain javascript

Hope this helps for others who has the same/similar problem integrating with yii.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top