最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

CI框架中集成CKEditor編輯器的教程

 更新時(shí)間:2014年06月09日 16:27:22   作者:  
CKEditor是在很多開(kāi)發(fā)過(guò)程中都會(huì)用到的一個(gè)富文本編輯器,那么如何在CI框架中使用它呢?這里介紹了在CI下使用CKEditor的方法,版本比較低,是在CI 1.7.3下使用fckeditor 2.6.6。供大家參考。

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、創(chuàng)建helper,在/system/application/helpers新建form_helper.php

復(fù)制代碼 代碼如下:

<?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、在項(xiàng)目中使用fckeditor

復(fù)制代碼 代碼如下:

<?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 );
?>

相關(guān)文章

  • Zend Framework教程之Zend_Controller_Plugin插件用法詳解

    Zend Framework教程之Zend_Controller_Plugin插件用法詳解

    這篇文章主要介紹了Zend Framework教程之Zend_Controller_Plugin插件用法,結(jié)合實(shí)例形式詳細(xì)分析了Zend_Controller_Plugin插件的原理,使用方法與相關(guān)注意事項(xiàng),需要的朋友可以參考下
    2016-03-03
  • ThinkPHP整合百度Ueditor圖文教程

    ThinkPHP整合百度Ueditor圖文教程

    這篇文章主要介紹了ThinkPHP整合百度Ueditor的方法,圖文并茂,非常的詳細(xì),希望對(duì)大家能有所幫助
    2014-10-10
  • 用php實(shí)現(xiàn)分頁(yè)效果的示例代碼

    用php實(shí)現(xiàn)分頁(yè)效果的示例代碼

    分頁(yè)效果在網(wǎng)頁(yè)中是常見(jiàn)的,可是怎樣才能實(shí)現(xiàn)分頁(yè)呢,今天做了兩種方法來(lái)實(shí)現(xiàn)一下分頁(yè)的效果,本文通過(guò)實(shí)例圖文相結(jié)合給大家介紹的非常詳細(xì),需要的朋友參考下吧
    2020-12-12
  • PHP開(kāi)發(fā)APP端微信支付功能

    PHP開(kāi)發(fā)APP端微信支付功能

    這篇文章主要為大家詳細(xì)介紹了PHP開(kāi)發(fā)APP端微信支付的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-02-02
  • 基于jQueryUI和Corethink實(shí)現(xiàn)百度的搜索提示功能

    基于jQueryUI和Corethink實(shí)現(xiàn)百度的搜索提示功能

    這篇文章主要介紹了基于jQueryUI和Corethink實(shí)現(xiàn)百度的搜索提示功能,這里是以corethink模塊的形式,只需要安裝上訪問(wèn)index.php?s=/test/index 就可以了,需要的朋友可以參考下
    2016-11-11
  • Laravel框架學(xué)習(xí)筆記(一)環(huán)境搭建

    Laravel框架學(xué)習(xí)筆記(一)環(huán)境搭建

    本文主要是把自己學(xué)習(xí)Laravel框架中的經(jīng)驗(yàn)寫(xiě)下來(lái)。這是本系列的第一篇,工欲善其事必先利其器,先把環(huán)境搭建好吧,之前也沒(méi)寫(xiě)過(guò)什么文章,可能文章結(jié)構(gòu)比較混亂,想到那寫(xiě)到哪。
    2014-10-10
  • laravel框架中間件 except 和 only 的用法示例

    laravel框架中間件 except 和 only 的用法示例

    這篇文章主要介紹了laravel框架中間件 except 和 only 的用法,簡(jiǎn)單說(shuō)明了中間件 except 和 only的功能,并結(jié)合實(shí)例形式分析了laravel框架中間件 except 和 only 相關(guān)使用技巧,需要的朋友可以參考下
    2019-07-07
  • 使用php實(shí)現(xiàn)從身份證中提取生日

    使用php實(shí)現(xiàn)從身份證中提取生日

    本文給大家分享的是一則使用php實(shí)現(xiàn)的從身份證中提取出生日期的函數(shù),非常的簡(jiǎn)單,有需要的小伙伴可以參考下
    2016-05-05
  • php加密解密實(shí)用類分享

    php加密解密實(shí)用類分享

    加密和解密是一項(xiàng)常規(guī)任務(wù),這里介紹一個(gè)加解密類。如果你想在用戶忘記密碼時(shí)為他或她找回原來(lái)的密碼,那么這個(gè)類是個(gè)好用的工具
    2014-01-01
  • 詳解php用curl調(diào)用接口方法,get和post兩種方式

    詳解php用curl調(diào)用接口方法,get和post兩種方式

    本篇文章主要介紹了詳解php用curl調(diào)用接口方法,get和post兩種方式,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-01-01

最新評(píng)論

东台市| 永福县| 长海县| 长子县| 玛纳斯县| 化州市| 虎林市| 辽阳县| 仪征市| 舞钢市| 福建省| 新晃| 晋江市| 汝南县| 民权县| 高要市| 穆棱市| 东安县| 孝义市| 盐山县| 乌拉特后旗| 冀州市| 长阳| 渝中区| 山阳县| 侯马市| 运城市| 子长县| 昌宁县| 黄石市| 满城县| 施甸县| 治县。| 双城市| 扬中市| 昂仁县| 舞阳县| 弥渡县| 金溪县| 兴化市| 广东省|