CI框架中集成CKEditor编辑器的教程
来源:互联网 发布:jquery点击事件源码 编辑:程序博客网 时间:2024/06/02 04:15
CI框架中集成CKEditor编辑器的教程
作者: 字体:[增加 减小] 类型:转载 时间:2014-06-09
CKEditor是在很多开发过程中都会用到的一个富文本编辑器,那么如何在CI框架中使用它呢?这里介绍了在CI下使用CKEditor的方法,版本比较低,是在CI 1.7.3下使用fckeditor 2.6.6。供大家参考。
<iframe id="cproIframe_u1892994_2" marginheight="0" src="http://pos.baidu.com/acom?adn=3&at=231&aurl=&cad=1&ccd=24&cec=gb2312&cfv=16&ch=0&col=zh-cn&conBW=0&conOP=1&cpa=1&dai=2&dis=0&ltr=&ltu=http%3A%2F%2Fwww.jb51.net%2Farticle%2F50840.htm&lu_161=0&lunum=6&n=jb51_cpr&pcs=1522x710&pis=10000x10000&ps=516x296&psr=1536x864&pss=1522x710&qn=67110bc3b3c16440&rad=&rsi0=580&rsi1=90&rsi5=4&rss0=%23FFFFFF&rss1=%23F7FCFF&rss2=%230000ff&rss3=%23444444&rss4=%23008000&rss5=&rss6=%23e10900&rss7=&scale=&skin=tabcloud_skin_3&stid=5&td_id=1892994&titFF=%E5%AE%8B%E4%BD%93&titFS=12&titTA=left&tn=text_default_580_90&tpr=1440659874652&ts=1&version=2.0&xuanting=0&dtm=BAIDU_DUP2_SETJSONADSLOT&dc=2&di=u1892994&ti=CI%E6%A1%86%E6%9E%B6%E4%B8%AD%E9%9B%86%E6%88%90CKEditor%E7%BC%96%E8%BE%91%E5%99%A8%E7%9A%84%E6%95%99%E7%A8%8B_php%E5%AE%9E%E4%BE%8B_%E8%84%9A%E6%9C%AC%E4%B9%8B%E5%AE%B6&tt=1440659874607.254.317.317" allowtransparency="true" marginwidth="0" scrolling="no" align="center,center" frameborder="0" height="90" width="580"></iframe>
1、将fckeditor目录置入CI_PATH/system/plugins/
2、在CI_PATH/system/application/config/config.php中加入:
$config['fckeditor_basepath'] = "/system/plugins/fckeditor/";
$config['fckeditor_toolbarset_default'] = 'Default';
3、创建helper,在/system/application/helpers新建form_helper.php
复制代码 代码如下:
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
include_once( BASEPATH . '/helpers/form_helper'.EXT);
function form_fckeditor($data = '', $value = '', $extra = '')
{
$CI =& get_instance();
$fckeditor_basepath = $CI->config->item('fckeditor_basepath');
require_once( $_SERVER["DOCUMENT_ROOT"] . $fckeditor_basepath. 'fckeditor.php' );
$instanceName = ( is_array($data) && isset($data['name']) ) ? $data['name'] : $data;
$fckeditor = new FCKeditor($instanceName);
if( $fckeditor->IsCompatible() )
{
$fckeditor->Value = html_entity_decode($value);
$fckeditor->BasePath = $fckeditor_basepath;
if( $fckeditor_toolbarset = $CI->config->item('fckeditor_toolbarset_default'))
$fckeditor->ToolbarSet = $fckeditor_toolbarset;
if( is_array($data) )
{
if( isset($data['value']) )
$fckeditor->Value = html_entity_decode($data['value']);
if( isset($data['basepath']) )
$fckeditor->BasePath = $data['basepath'];
if( isset($data['toolbarset']) )
$fckeditor->ToolbarSet = $data['toolbarset'];
if( isset($data['width']) )
$fckeditor->Width = $data['width'];
if( isset($data['height']) )
$fckeditor->Height = $data['height'];
}
return $fckeditor->CreateHtml();
}
else
{
return form_textarea( $data, $value, $extra );
}
}
?>
4、在项目中使用fckeditor
复制代码 代码如下:
<?php
$this->load->helper('form_helper');
$data = array(
'name' => 'newsContent',
'id' => 'newsContent',
//'toolbarset' => 'Advanced',
'basepath' => $this->config->item('fckeditor_basepath'),
'width' => '80%',
'height' => '200'
);
echo form_fckeditor( $data );
?>
搜狐“我来说两句”用户公约
0 0
- CI框架中集成CKEditor编辑器的教程
- CI框架集成CkEditor编辑器
- 极光推送集成CI框架中
- 【军哥谈CI框架】之CI中集成百度UEditor
- 【ci框架】ci框架引入ueditor编辑器
- 【ci框架】ci框架查询中join的使用
- 【ci框架】PHP的CI框架集成Smarty的最佳方式
- ci框架集成七牛云sdk
- PHP的CI框架集成Smarty的最佳方式
- PHP的CI框架集成Smarty的最佳方式
- PHP的CI框架集成Smarty的最佳方式
- PHP的CI框架集成Smarty的最佳方式
- 【ci框架】CI中site_url()和base_url()的区别
- CI框架(九)CI中site_url()和base_url()的区别
- CKEditor编辑器的用法
- CKeditor编辑器的配置
- TFS2015的CI集成
- Flask项目集成富文本编辑器CKeditor
- &与&&的区别
- calcBackProject函数(搜索小物体的位置)
- Android HttpGet和HttpPost设置超时
- hdoj 3667 Transportation 【拆边 + 最小费用最大流】
- 上一周,小白的我试着搭建了两个个人博客:在github和openshift上
- CI框架中集成CKEditor编辑器的教程
- 牛小新该怎么走
- IntelliJ IDEA14.1中java项目Maven中没有配置JDK时的问题
- 今年暑假不AC
- 多线程还是多进程的选择及区别
- ngGrid checkbox应用
- [leetcode]Plus One C语言
- WebService入门介绍及案例分析(1)
- 实用网址