加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – CodeIgniter中的CKEditor

发布时间:2020-12-13 22:36:33 所属栏目:PHP教程 来源:网络整理
导读:我想在CodeIgniter中加载CKEditor,我搜索了很多,但无法理解他们的方式. 我将ckeditor放在application / plugins文件夹中,现在我想编辑器,所以我在Controller Method中做了以下操作. include APPPATH.'plugins/ckeditor/ckeditor.php';$CKEditor = new CKEdit
我想在CodeIgniter中加载CKEditor,我搜索了很多,但无法理解他们的方式.

我将ckeditor放在application / plugins文件夹中,现在我想编辑器,所以我在Controller Method中做了以下操作.

include APPPATH.'plugins/ckeditor/ckeditor.php';
$CKEditor = new CKEditor();
$CKEditor->basePath = '/'.APPPATH.'plugins/ckeditor/';
$initialValue = '<p>This is some <strong>sample text</strong>.</p>';
echo $CKEditor->editor("editor1",$initialValue);

但它只是简单的teaxaria,这是一些示例文本.值.
问题在哪里,我该如何解决?

我使用此步骤将ckeditor添加到我的codeigniter应用程序:

1)下载这些文件:

>这对于Ckeditor:http://pastebin.com/fkK9e0RR
>这对于Ckfinder:http://pastebin.com/SvyypmX4

2)将刚下载的文件复制到Application / libraries文件夹中

3)在这里下载ckeditor助手:http://pastebin.com/Cd3GqYbx

4)将application / helper文件夹中的最后一个文件复制为ckeditor_helper.php

5)在此处下载CKeditor控制器:http://pastebin.com/UD0bB9ig

6)将应用程序/控制器文件夹中的控制器复制为ckeditor.php

7)从官方网站下载主要的ckeditor项目:http://ckeditor.com/download/

8)将刚下载的ckeditor文件夹复制到资产文件夹中(如果需要,也可以下载ckfinder项目并将其放在同一个文件夹中)

9)将这些js行添加到视图文件中(调整路径):

<script type="text/javascript" src="/asset/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/asset/ckfinder/ckfinder.js"></script>

10)在你的控制器中添加这个php代码并调整路径:

$this->load->library('ckeditor');
$this->load->library('ckfinder');



$this->ckeditor->basePath = base_url().'asset/ckeditor/';
$this->ckeditor->config['toolbar'] = array(
                array( 'Source','-','Bold','Italic','Underline','Cut','Copy','Paste','PasteText','PasteFromWord','Undo','Redo','NumberedList','BulletedList' )
                                                    );
$this->ckeditor->config['language'] = 'it';
$this->ckeditor->config['width'] = '730px';
$this->ckeditor->config['height'] = '300px';            

//Add Ckfinder to Ckeditor
$this->ckfinder->SetupCKEditor($this->ckeditor,'../../asset/ckfinder/');

11)在您的视图中打印编辑器:

echo $this->ckeditor->editor("textarea name","default textarea value");

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读