Hi all,
I’m building a CMS using Yii and currently I’m integrating the “CK editor” to my forms. I have successfully integrated it and the editor is currently appearing in my view.
(I used the ckeditor-integration widget for this)
I was using a view generated by Gii tool. But now i need it to be converted to so that I can use "CK editor" for some fields.
Below is my code for _form.php
<div class="form">
<fieldset>
<legend>Add/Edit Page</legend>
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'pagecontent-form',
'enableAjaxValidation'=>false,
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
<?php
$this->widget('application.modules.admincms.extensions.ckeditor.CKEditorWidget',array(
"model"=>$model, # Data-Model
"attribute"=>'html_content', # Attribute in the Data-Model
"defaultValue"=>"Test Text", # Optional
# Additional Parameter (Check http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html)
"config" => array(
"height"=>"50px",
"width"=>"100%",
"toolbar"=>"Full",
),
) );
?>
<div class="row">
<?php echo $form->labelEx($model,'sef_url', array('class'=>'form_controller')); ?>
<?php echo $form->textField($model,'sef_url',array('size'=>50,'maxlength'=>50)); ?><br />
<?php echo $form->error($model,'sef_url'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'menu_heading', array('class'=>'form_controller')); ?>
<?php echo $form->textField($model,'menu_heading',array('size'=>60,'maxlength'=>100)); ?><br />
<?php echo $form->error($model,'menu_heading'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'html_content', array('class'=>'form_controller')); ?>
<?php echo $form->textArea($model,'html_content',array('rows'=>6, 'cols'=>50)); ?><br />
<?php echo $form->error($model,'html_content'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'html_content2', array('class'=>'form_controller')); ?>
<?php echo $form->textArea($model,'html_content2',array('rows'=>6, 'cols'=>50)); ?><br />
<?php echo $form->error($model,'html_content2'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'html_h1', array('class'=>'form_controller')); ?>
<?php echo $form->textField($model,'html_h1',array('size'=>60,'maxlength'=>200)); ?><br />
<?php echo $form->error($model,'html_h1'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'html_title', array('class'=>'form_controller')); ?>
<?php echo $form->textField($model,'html_title',array('size'=>60,'maxlength'=>200)); ?><br />
<?php echo $form->error($model,'html_title'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'meta_keywords', array('class'=>'form_controller')); ?>
<?php echo $form->textArea($model,'meta_keywords',array('rows'=>6, 'cols'=>50)); ?><br />
<?php echo $form->error($model,'meta_keywords'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'meta_description', array('class'=>'form_controller')); ?>
<?php echo $form->textArea($model,'meta_description',array('rows'=>6, 'cols'=>50)); ?><br />
<?php echo $form->error($model,'meta_description'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'published', array('class'=>'form_controller')); ?>
<?php echo $form->checkBox($model,'published'); ?><br />
<?php echo $form->error($model,'published'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'parent_pageid', array('class'=>'form_controller')); ?>
<?php echo $form->dropDownList($model,'parent_pageid', Pagecontent_cms::parentpageID(), array('prompt'=>'none')); ?><br />
<?php echo $form->error($model,'parent_pageid'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
</div>
<?php print_r($x); ?>
<?php $this->endWidget(); ?>
</fieldset>
</div><!-- form -->
The problem is I’m not sure how to convert
<div class="row">
<?php echo $form->labelEx($model,'meta_description', array('class'=>'form_controller')); ?>
<?php echo $form->textArea($model,'meta_description',array('rows'=>6, 'cols'=>50)); ?><br />
<?php echo $form->error($model,'meta_description'); ?>
</div>
to be suitable for the CKeditor. Can anyone help me in this please? Or a tutorial?
Any help is much appreciated.
Thanks