YII 中使用Ueditor

This extension allows to add UEditor in a view.

Usage 

...how to use this extension...

...can use code blocks like the following...

  1. UEditor download
  2. UEditor extension download and copy UEditor.php under ext.ueditor
  3. add the following code to your view file
<?php
    $this->widget('ext.ueditor.UEditor',
            array(
                'id'=>'editor',
                'model'=>$model,
                'attribute'=>'content',
                'UEDITOR_CONFIG'=>array(
                    'UEDITOR_HOME_URL'=>Yii::app()->baseUrl.'/ueditor/',
                    'initialContent'=>'欢迎',
                    'imageUrl'=>Yii::app()->baseUrl.'/ueditor/php/imageUp.php',
                    'imagePath'=>Yii::app()->baseUrl.'/ueditor/php/',
                    'emotionLocalization'=>true,
                    'pageBreakTag'=>'[page]',
                    /*
                    'toolbars'=>array(
                        array(
                            'fullscreen', 'source', '|', 'undo', 'redo', '|',
                        ),
                    ),
                    'labelMap'=>array(
                        'fullscreen'=>'全屏','source'=>'源代码','redo'=>'重做','undo'=>'撤销',
                    ),
                    */
                ),
 
            ));
?>

Below is an example of directory organization

WebRoot/  
   assets  
   protected/  
       components/  
       controllers/  
       extensions/  
           ueditor/  
               UEditor.php  
       models/  
       views/  
   ueditor/   //(copy ueditor code resources,please download UEditor first )                  
   index.php  
   index-test.php
/*
		对于前台提交过来的数据需要将其HTML进行特殊处理

		//获取数据转化HTML特殊字符

		$content =  htmlspecialchars(stripslashes($_POST['content']));

		2. 然后可以读入数据库中

		在读取显示数据的时候需要对转义的HTML进行解码;

		3. 使用htmlspecialchars_decode($content);显示即可

		Ueditor的基本使用如此!
	*/


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值