php – CodeIgniter中的CKEditor

前端之家收集整理的这篇文章主要介绍了php – CodeIgniter中的CKEditor前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在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");

猜你在找的PHP相关文章