尝试将CKEditor与Yii Framework一起用于我的textarea
我收到此错误
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
及以下是扩展类
保护\扩展\ 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
有人可以解释一下会有很大帮助的原因和解决方案。
答案 0 :(得分:0)
扩展和集成看起来很糟糕,后来我发现了这个链接及其非常有用的
用于将CKEditor与Yii集成
Step by Step tutorial using plain javascript
希望这有助于与yii整合相同/类似问题的其他人。