Yii新手在这里, 我想知道是否有渲染我之前在CKEditor TextArea中创建的视图。
我尝试在value属性中进行渲染,但不幸的是它没有工作。
有没有办法做到这一点?或者我应该创建一个单独的功能并将页面输出到文本区域?
非常感谢任何提示,建议或指示!谢谢
<?php
$this->widget('application.extension.CKEditor.TheCKEditorWidget', array(
'model' => $model,
'attribute' => 'body',
'value' => //rendered page,
'height' => '400px',
'width' => '800px',
'toolbarSet' => 'Full',
'ckeditor' => Yii::app()->basePath . '/../ckeditor/ckeditor.php',
'ckBasePath' => Yii::app()->baseUrl . '/ckeditor/',
'css' => Yii::app()->baseUrl . '/css/index.css',
)); ?>
答案 0 :(得分:1)
如果您指定value
和model
属性,则不会使用attribute
属性。因此,为了在CKeditor中显示某些内容,您必须在呈现窗口小部件之前将其指定为$model->body="Your content goes here"
。在您的情况下,您必须在CKEditor中呈现视图。因此,将CController::render()
函数与第三个参数一起使用为true。即
<?php
$model->body=$this->render("viewName",array(),true);
$this->widget('application.extension.CKEditor.TheCKEditorWidget', array(
'model' => $model,
'attribute' => 'body',
'height' => '400px',
'width' => '800px',
'toolbarSet' => 'Full',
'ckeditor' => Yii::app()->basePath . '/../ckeditor/ckeditor.php',
'ckBasePath' => Yii::app()->baseUrl . '/ckeditor/',
'css' => Yii::app()->baseUrl . '/css/index.css',
)); ?>