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

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

 更新時間:2014年06月09日 16:27:22   作者:  
CKEditor是在很多開發(fā)過程中都會用到的一個富文本編輯器,那么如何在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

復制代碼 代碼如下:

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

相關文章

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

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

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

    ThinkPHP整合百度Ueditor圖文教程

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

    用php實現分頁效果的示例代碼

    分頁效果在網頁中是常見的,可是怎樣才能實現分頁呢,今天做了兩種方法來實現一下分頁的效果,本文通過實例圖文相結合給大家介紹的非常詳細,需要的朋友參考下吧
    2020-12-12
  • PHP開發(fā)APP端微信支付功能

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

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

    基于jQueryUI和Corethink實現百度的搜索提示功能

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

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

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

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

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

    使用php實現從身份證中提取生日

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

    php加密解密實用類分享

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

    詳解php用curl調用接口方法,get和post兩種方式

    本篇文章主要介紹了詳解php用curl調用接口方法,get和post兩種方式,小編覺得挺不錯的,現在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-01-01

最新評論

泸西县| 洛宁县| 汶川县| 怀宁县| 宜川县| 天气| 丰宁| 盘锦市| 桃江县| 灵石县| 那坡县| 堆龙德庆县| 长葛市| 商洛市| 平南县| 运城市| 额敏县| 德昌县| 南皮县| 浮梁县| 靖安县| 河东区| 上高县| 会泽县| 扎赉特旗| 霍山县| 井冈山市| 交城县| 新干县| 嫩江县| 武冈市| 石家庄市| 安西县| 巴青县| 普洱| 太白县| 通辽市| 迁安市| 江北区| 万宁市| 普格县|