CodeIgniter默认的根目录是index.php所在的目录。把
fckeditor放在了根目录下(index.php所在的目录),之后看以下代码:
在 application/models 下建立一个公用的取得FCK的模:editor.php
,如下:
function get_editor($name = 'content', $value = '', $toolbar = 'Default'){
$this->load->file('editor/fckeditor.php'); // 目录
$sBasePath = 'editor/';
$editor = new FCKeditor($name);
$editor->BasePath = $sBasePath;
$editor->ToolbarSet = $toolbar; //Basic,Default
$editor->Width = '90%';
$editor->Height = '300';
$editor->Value = $value;
return $editor;
}
// 说明: $name是 fck 的名,也就是用$_post['content']来获取fck的值
1. 首先设置自动加载,因为这个是公用的! 找到根目录(index.php所在的目录)找到 application/config/autoload.php 文件,第111行(以我的文档为准,O(∩_∩)O哈哈~),修改:
$autoload['model'] = array('editor');
2.然后在控制器中写入如下代码:
$data['editor'] = $this->editor->get_editor(); // 当然你也可以通过设置参数来达到你想要的意图,比如可以通过设置第二个参数来显示fck的默认内容,这个在后台修改显示的时候很有用。
3.最后在视图中写入代码:
<div><?=$editor->create()?></div>
ok,设置成功,最后附上我已经设置好的fck,精简到1.45mb,而且它的上传路径是自动调整的,默认为editor同级目录下的files文件夹,不用再麻烦你动手设置了....
分享到:
相关推荐
codeigniter中文文档codeigniter中文文档codeigniter中文文档codeigniter中文文档codeigniter中文文档
codeigniter中文手册教程 本人亲手制作的,从官网上下载页面回来后改造的,方便使用 解压后,用浏览器打开index.html就可以了
本资源包含: CodeIgniter中文参考手册.pdf; CodeIgniter用户指南(v1.7.2).chm; PHP敏捷开发框架CodeIgniter.chm。
CodeIgniter 中文手册1.6.3版本
CodeIgniter2.0中文手册
CodeIgniter_1.7版的简体中文语言包,直接复制到CodeIgniter中的\system\application\language文件夹中,可以将显示信息改变为简体中文,简单方便!
敏捷php开发框架CodeIgniter 1.7.1中文手册
PHP框架的应用,简称CI。可以参http://codeigniter.org.cn/user_guide/index.html
官网下载的CodeIgniter3帮助文档然后整理后做成的PDF 现在codeigniter使用的人不多,但其实还是挺不错的 希望对您有用
codeigniter中文.pdf 一本简单介绍CI框架使用的手册,内容有对比,更简洁易懂,但如果要深入学习,还是要多到社区里查阅资料
CodeIgniter2.0中文手册 CodeIgniter2.0中文手册.chm
CodeIgniter2.0中文手册 CHM版
CodeIgniter 2.2.2 中文文档。 从中文官网抓取。 html压缩包版本。
CodeIgniter最新版 CodeIgniter1.72版 帮助文档 帮助文件
codeigniter框架的源代码,代码文件的结构比较清晰,又index.php作为入口,在codeigniter.php文件中加载所有的基础类,于是我挨个类滴看下去,并且在看的时候分析了每一步关键的进程,而且对原来的英文注释进行了翻译,现在...
CodeIgniter3.00中文手册.pdf,检索方便,2015年09月23日修订
codeigniter(CI)中文手册下载
CodeIgniter3.1.3 中文手册。它的MVC架构以及对扩展的支持都使应用开发变得很简单。
CodeIgniter2.1.4中文手册HTML离线版,是目前最新版本的,本人亲测,完美使用。