Yii:在编辑器文本区域内渲染视图
我是新手, 我想知道是否有任何方式来渲染我以前在CKEditor文本区域中创建的视图 我尝试在value属性中呈现它,但不幸的是,它不起作用 有没有办法做到这一点?或者我应该创建一个单独的函数并将页面输出到文本区域 非常感谢任何提示、建议或指点!!多谢各位Yii:在编辑器文本区域内渲染视图,yii,ckeditor,yii-extensions,Yii,Ckeditor,Yii Extensions,我是新手, 我想知道是否有任何方式来渲染我以前在CKEditor文本区域中创建的视图 我尝试在value属性中呈现它,但不幸的是,它不起作用 有没有办法做到这一点?或者我应该创建一个单独的函数并将页面输出到文本区域 非常感谢任何提示、建议或指点!!多谢各位 <?php $this->widget('application.extension.CKEditor.TheCKEditorWidget', array( 'model' =>
<?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',
)); ?>
如果指定
模型
和属性
属性,则不使用值
属性。因此,为了在CKeditor中显示某个内容,您必须在呈现小部件之前将其指定为$model->body=“您的内容在这里”
。在本例中,必须在CKEditor中渲染视图。因此,使用第三个参数为true的函数CController::render()。即
<?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',
)); ?>
请参阅本文