Yii Newbie here, I was wondering if there was anyway to render a view which I have previously made inside a CKEditor TextArea.
I tried rendering it inside the value attribute, but unfortunately it didn't work.
Is there any way to do this? or should I create a seperate function and output the page into the text area?
Any tips, advices or pointers are greatly appreciated !! Thank You
<?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',
)); ?>
The value
attribute is not used if you specify model
and attribute
attributes. So inorder to display a something inside CKeditor you must specify it as $model->body="Your content goes here"
before rendering the widget. In your case you have to render a view inside CKEditor. So use CController::render()
function with third parameter as true. ie
<?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',
)); ?>