2015-12-07 13:27:42 3759次浏览 3条回答 0 悬赏 10 金钱
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/12/7
 * Time: 11:34
 */
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/12/6
 * Time: 14:29
 */
use \kucha\ueditor\UEditor;
?>
<?php echo UEditor::widget([
    'clientOptions' => [
        //编辑区域大小
        'initialFrameHeight' => '200',
        //设置语言
        'lang' =>'en', //中文为 zh-cn
        //定制菜单
        'toolbars' => [
            [
                'fullscreen', 'source', 'undo', 'redo', '|',
                'fontsize',
                'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
                'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|',
                'forecolor', 'backcolor', '|',
                'lineheight', '|',
                'indent', '|'
            ],
        ]
    ]
]);
?>

报错:Either 'name', or 'model' and 'attribute' properties must be specified.

谁能解救下,不太会用

  • 回答于 2015-12-09 02:01 举报

    没有Model,和name属性吧,一般用在表单型里面,都有model和name属性的

    
        <?= $form->field($model, 'content')->widget(
            \kucha\ueditor\UEditor::className(),
            [
                //'name' => 'content',
                //'id' => 'Article[content]',
                //'attribute' => 'content',
                //'model' => $model,
                'clientOptions' => [
                    //编辑区域大小
                    'initialFrameHeight' => '200',
                    //设置语言
                    'lang' => 'zh-cn', //中文为 zh-cn 英文为 en
                    'zIndex' => 1500,
    
  • 回答于 2015-12-09 09:03 举报

    页面是否使用

    <?php $this->beginPage() ?>
    <?php $this->beginBody() ?>
    <?php $this->head() ?>
    
    
  • 回答于 2015-12-16 09:49 举报

    你必须要把 name 或者model和attribute 这些指定的属性添加进去
    只填name一般只是用于文本提交
    model和attribute就是提交修改文本

         <?= UEditor::widget([
                'model'=>$model,
                'attribute'=>'post_content',
                'options'=>['style'=>'height:400px;']
         		,
         		'clientOptions' => [
         		//编辑区域大小
         		'initialFrameHeight' => '200',
         		//设置语言
         		'lang' =>'en', //中文为 zh-cn
         		//定制菜单
         		'toolbars' => [
         		[
         		'fullscreen', 'source', 'undo', 'redo', '|',
         		'fontsize',
         		'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'removeformat',
         		'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|',
         		'forecolor', 'backcolor', '|',
         		'lineheight', '|',
         		'indent', '|'
         				],
         				]
         				]
            ])?>
    
您需要登录后才可以回答。登录 | 立即注册
proee
助理

proee

注册时间:2015-12-01
最后登录:2016-06-20
在线时长:8小时3分
  • 粉丝1
  • 金钱50
  • 威望0
  • 积分130

热门问题