1、下载CKEditor和CFinder
CKEditor下载地址:
http://ckeditor.com/download
CKFinder下载地址:
http://ckfinder.com/download
2、解压安装
将CKEditor解压之后,将其中的ckeditor放到网站根目录下
将CKFinder解压之后,将其中的CKFinder放到网站根目录下
3、修改ckfinder的config.php
对ckfinder文件下的config.php文件里的function CheckAuthentication()——–return false 改为return true。
修改下面的
$baseUrl =’/dwxcb/upload/’;
(自己的路径,相对)
$baseUrl =’/dwxcb/upload/’;
(自己的路径,相对)
4.整合到CI
复制ckfinder/core/ckfinder_php5.php文件内容一份到ci/application/libraries/命名为ckfinder.php。
复制ckeditor/ckeditor_php5.php文件内容一份到ci/application/libraries/命名为为ckdeitor.php。
5.CI控制器调用
$this->load->library(‘ckeditor’);
$this->load->library(‘ckfinder’);
$this->ckeditor = new CKEditor();
$this->ckeditor->basePath = base_url().’ckeditor/’;
$this->ckeditor->config['toolbar'] = ‘Full’;
CKFinder::SetupCKEditor($this->ckeditor, base_url().’ckfinder/’);
$this->load->library(‘ckfinder’);
$this->ckeditor = new CKEditor();
$this->ckeditor->basePath = base_url().’ckeditor/’;
$this->ckeditor->config['toolbar'] = ‘Full’;
CKFinder::SetupCKEditor($this->ckeditor, base_url().’ckfinder/’);
6.页面调用
<textarea id=”editor1″ name=”neirong” cols=”85″ rows=”10″ style=”display:none;”></textarea>
<?php echo $this->ckeditor->replace(“editor1″); ?>
<?php echo $this->ckeditor->replace(“editor1″); ?>
转载于:https://blog.51cto.com/njyanglinghui/1050602