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 <span>sample text</span>.</p>';
echo $CKEditor->editor("editor1", $initialValue);
但它仅使简单的Teaxaria具有 This is some sample text.
值。
问题出在哪里,我应该如何解决?
最佳答案
我使用以下步骤将ckeditor添加到我的codeigniter应用程序中:
1)下载以下文件:
- 此项目适用于Ckeditor:http://pastebin.com/fkK9e0RR
- 用于Ckfinder:http://pastebin.com/SvyypmX4
2)将您刚刚下载的文件复制到应用程序/库文件夹中
3)在此处下载ckeditor助手:http://pastebin.com/Cd3GqYbx
4)将应用程序/帮助程序文件夹中的最后一个文件复制为 ckeditor_helper.php
5)在此处下载CKeditor Controller :http://pastebin.com/UD0bB9ig
6)将应用程序/ Controller 文件夹中的 Controller 复制为 ckeditor.php
7)从官方站点http://ckeditor.com/download/下载主要的ckeditor项目
8)将您刚刚下载的ckeditor文件夹复制到 Assets 文件夹中(如果需要,您也可以下载ckfinder项目并将其放在同一文件夹中)
9)将这些js行添加到您的 View 文件中(调整路径):
<script type="text/javascript" src="https://www.coder.work/asset/ckeditor/ckeditor.js"></script><script type="text/javascript" src="https://www.coder.work/asset/ckfinder/ckfinder.js"></script>
10)在您的 Controller 中添加以下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)在您的 View 中,使用以下命令打印编辑器:
echo $this->ckeditor->editor("textarea name","default textarea value");
以上是 CodeIgniter如何加载CKEditor? 的全部内容, 来源链接: www.h5w3.com/122622.html