【问题标题】:TheCKEditorWidget cannot find the view "ckeditor". yii errorCKEditorWidget 找不到视图“ckeditor”。 yii 错误
【发布时间】:2014-03-12 11:01:57
【问题描述】:

尝试将 CKEditor 与 Yii 框架一起用于我的文本区域

我收到此错误

TheCKEditorWidget 找不到视图“TheCKEditorWidget

这是我的观点_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
    ) );

以及它们的用途,以下 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

下面是扩展类

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,
        ));
    }
}

当我运行该特定视图 _form 被调用时,我收到此错误

**TheCKEditorWidget 找不到视图“TheCKEditorWidget

有人能解释一下原因和解决方案吗?

【问题讨论】:

    标签: php yii ckeditor yii-extensions


    【解决方案1】:

    扩展和集成看起来很糟糕,后来我发现这个链接非常有用

    用于将 CKEditor 与 Yii 集成

    Step by Step tutorial using plain javascript

    希望这对与 yii 集成有相同/相似问题的其他人有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-08
      • 2015-07-27
      • 1970-01-01
      • 2017-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-18
      相关资源
      最近更新 更多