用户
 找回密码
 入住 CI 中国社区
搜索
查看: 21471|回复: 28
收起左侧

[Others] CI集成ckeditor配置

    [复制链接]
发表于 2010-5-22 12:01:15 | 显示全部楼层 |阅读模式
本帖最后由 aican0830 于 2010-5-24 20:33 编辑

配置ckeditor
1.上传下载ckeditor文件和ckckfinder到网站根目录js目录下。
2.ckeditor/ckeditor_php5.php 改名为ckeditor.php 放入libraries  ,ckfinder/ckfinder.php 文件放入libraries  。
3.controllers 使用
PHP复制代码
 
$this->load->library('ckeditor');
$this->load->library('ckFinder');
$this -> ckeditor = new CKEditor();
$this -> ckeditor->basePath = '/js/ckeditor/';
$this -> ckeditor -> config['toolbar'] = 'Full';
$this -> ckeditor -> config['language'] = 'zh-tw';// $this -> ckeditor -> config[''] 添加一些你需要的配置详细参数自己查一下
CKFinder::SetupCKEditor($this -> ckeditor, '/js/ckfinder/');
 
复制代码

4.views
HTML复制代码
 
<script src="<?php echo base_url();?>js/ckeditor/ckeditor.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo base_url();?>js/ckfinder/ckfinder.js"></script>
 
复制代码

显示ckeditor
PHP复制代码
 
<?php echo $this->ckeditor->editor("mailtpl_content", $edit_row['mailtpl_content']);?>
 
复制代码



修改一下ckfinder/config.php  
设置图片上传权限
PHP复制代码
 
function CheckAuthentication()
{
        return true;//第32行 false改为true
}
$baseUrl = '/js/ckfinder/userfiles/'; //图片上传目录
 
复制代码



这个图片是我事先放进去的图片

这里我郁闷了。在本地可以上传图片。
传到网上就提示这个。上传和删除都会提示


提示不能上传时因为图片目录权限问题。

评分

参与人数 2威望 +10 收起 理由
vsgeping + 5 精品文章
Hex + 5 原创内容

查看全部评分

发表于 2014-5-27 17:53:11 | 显示全部楼层
1.编辑器,我喜欢集成kindeditor
2.验证码喜欢集成gg的

总之要取长补短
发表于 2014-5-27 17:52:51 | 显示全部楼层
1.编辑器,我喜欢集成kindeditor
2.验证码喜欢集成gg的

总之要取长补短
发表于 2014-5-27 11:43:22 | 显示全部楼层
ueditor如何获取编辑器写的内容?
发表于 2010-5-22 21:50:45 | 显示全部楼层
我前几天弄ckeditor也总是提示没有权限,就没去动它了,原来还有个重写的文件呀。
后来选择了kindetitor,所以就写了个helper函数
PHP复制代码
 
 
/**
 *
 * 自动生成kind富文本编辑器函数
 * @param $name string 编辑器ID与name
 * @param $kindjs string js路径
 * @param $kindConfig array kindetitor配置,通过json_encode函数把数组编码为json格式
 * @return string 返回kindeditor
 * */

function kindText($name='message',$kindjs='',$kindConfig='')
{
    $CI = & get_instance();
    $base_url = $CI->config->slash_item('base_url');
    $kindjs = $kindjs?$kindjs:$base_url.'js/kindeditor.js';
   
    $kindConfig['id'] = $name;
    $CI->load->helper('array');
    if(!element('width',$kindConfig))
    {
        $kindConfig['width'] = '100%';
    }
    if(!element('height',$kindConfig))
    {
        $kindConfig['height'] = '400px';
    }
    if(!element('resizeMode',$kindConfig))
    {
        $kindConfig['resizeMode'] = 1;
    }
    if(!element('allowFileManager',$kindConfig))
    {
        $kindConfig['allowFileManager'] = 'true';
    }
    $kind = json_encode($kindConfig);
   
    $strText = '<div class="editor">
        <textarea id="'
.$name.'" name="'.$name.'" rows="10" cols="30"></textarea>
        <script src="'
.$kindjs.'" type="text/javascript"></script>
        <script type="text/javascript">
        KE.show('
.$kind.');
        </script></div>'
;
        return $strText;
}
 
复制代码

非常简陋的函数,各位不要见笑(把kindetitor文件放在index.php同一个文件夹js中就可以使用函数echo kind();生成kindetitor了)。最近一直在找一个简介好用的富文本编辑器,还发现了淘宝的kissy editor,非常简介实用,可是发现也还只是应用execcommand罢了,而事实上execcommand并不适合中国人的习惯,比如,英文喜欢用整段缩进,而且段首不缩进,这就是execcommand indent的作用,但是却从来没有哪个js编辑器能够实现首行缩进两个字符。期待……
发表于 2010-6-1 01:00:19 | 显示全部楼层
本帖最后由 xpengzp 于 2010-6-1 13:45 编辑

问题解决!!!
发表于 2010-6-1 01:10:02 | 显示全部楼层
本帖最后由 xpengzp 于 2010-6-1 14:00 编辑

目录结构:
    ckeditor
    ckfinder
    system
    uploads
    index.php

将ckeditor/ckeditor_php5.php 拷贝至 library 目录重命名为 ckeditor.php
将ckfinder/core/ckfinder_php5.php 拷贝至 library 目录重命名为 ckfinder.php
ckfinder/config.php 中 修改  $baseUrl = '/userfiles/';  为 $baseUrl = 'uploads/';
创建index.php文件等级目录 uploads

Controller:
PHP复制代码
 
function index() {    
    $this->load->library('ckeditor');
    $this->load->library('ckfinder');
    $this->ckeditor = new CKEditor();
    $this->ckeditor->basePath = 'ckeditor/';
    $this->ckeditor->config['toolbar'] = 'Full';
       
    CKFinder::SetupCKEditor($this->ckeditor, 'ckfinder/');        
    $this->load->view('welcome_message');
}
 
复制代码


view:
HTML复制代码
 
<p>
<textarea cols="30" id="content" name="content" style="display:none;"></textarea>
<?php echo $this->ckeditor->replace("content"); ?>
</p>
 
复制代码
发表于 2010-7-1 11:20:55 | 显示全部楼层
为何我这不显示缩略图呀,查看userfiles/_thumbs 没有生成图文件
是怎么回事呀,检查哪些地方。
发表于 2010-7-1 12:00:12 | 显示全部楼层
fckeditor上传内容时,需要找硬盘位置的绝对路径,如果开发环境是localhost,在开发环境下和实际服务器状态下,肯定是不一样的。
方法,在本地配置虚拟主机地址,如my.adc.com类似这样的开发地址。
发表于 2010-7-1 12:01:07 | 显示全部楼层
上传到服务器后,再把上边的my.abc.com更换为服务器的地址(域名),如http://www.my.abc.com即可。
发表于 2010-7-9 20:27:13 | 显示全部楼层
太麻烦了吧
你用ck
我用正宗的fckeditor
,可以直接iframe嵌套形式使用
发表于 2010-7-21 14:43:21 | 显示全部楼层
三楼的方法相当不错,适用。
发表于 2010-7-29 14:49:35 | 显示全部楼层
这个收藏一下!
以后慢慢研究!!!

本版积分规则