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 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"); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |