1.使用GRUD,完成基本的内容创建工作。设此次操作的类名为Content
2.在protected/model/content/content.php中, 在函数 public function attributeLabels()中,把标签中文化。
3.下载TinyMCE.将其解压,放入protected/extensions/中,完成安装。
4.在protected/view/content/_form.php中,使用代码如下:
<div class="row"> <?php echo $form->labelEx($model,'content'); ?> <?php $this->widget('application.extensions.tinymce.ETinyMce', array( 'model'=>$model, 'attribute'=>'content', 'language' =>"zh-cn" , 'editorTemplate'=>'full', 'htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'tinymce'), 'options' => array( 'theme_advanced_buttons1'=> 'undo,redo,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,outdent, indent,|,advhr,|,sub,sup,|,bullist,numlist,|,formatselect,fontselect,fontsizeselect,|,cut,copy,paste,pastetext,pasteword,|,search,replace,','theme_advanced_buttons2' => 'tablecontrols,|,removeformat,visualaid,', 'theme_advanced_buttons3'=> '', 'theme_advanced_buttons4' => '', 'theme_advanced_toolbar_location' => 'top', 'theme_advanced_toolbar_align'=> 'left', 'theme_advanced_statusbar_location' => 'none', 'theme_advanced_font_sizes' =>"10=10pt,11=11pt,12=12pt,13=13pt,14=14pt,15=15pt,16=16pt,17=17pt,18=18pt,19=19pt,20=20pt",) )); ?>