欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

相關文章

  • php隨機輸出名人名言的代碼

    php隨機輸出名人名言的代碼

    正如你看到的“小談博客”標題后面的名人名言一樣,每刷新一次就會隨機出現(xiàn)一條語句,把你喜歡的話放到一起,經(jīng)常出現(xiàn)在你眼前,給你溫暖的力量
    2012-10-10
  • laravel5.5安裝jwt-auth 生成token令牌的示例

    laravel5.5安裝jwt-auth 生成token令牌的示例

    今天小編就為大家分享一篇laravel5.5安裝jwt-auth 生成token令牌的示例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-10-10
  • Bootstrap+PHP實現(xiàn)多圖上傳功能實例詳解

    Bootstrap+PHP實現(xiàn)多圖上傳功能實例詳解

    這篇文章主要介紹了Bootstrap+PHP實現(xiàn)多圖上傳功能實例詳解,本文圖片加實例相結合的形式給大家介紹的非常詳細,需要的朋友可以參考下
    2018-04-04
  • php實現(xiàn)ffmpeg處理視頻的實踐

    php實現(xiàn)ffmpeg處理視頻的實踐

    本文主要介紹了php實現(xiàn)ffmpeg處理視頻的實踐,文中通過示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-12-12
  • Ecshop 后臺添加新功能欄目及管理權限設置教程

    Ecshop 后臺添加新功能欄目及管理權限設置教程

    這篇文章主要介紹了Ecshop 后臺添加新功能欄目及管理權限設置教程,需要的朋友可以參考下
    2017-11-11
  • 確保Laravel網(wǎng)站不會被嵌入到其他站點中的方法

    確保Laravel網(wǎng)站不會被嵌入到其他站點中的方法

    這篇文章主要介紹了確保Laravel網(wǎng)站不會被嵌入到其他站點中的方法,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2019-10-10
  • PHP通過微信跳轉的Code參數(shù)獲取用戶的openid(關鍵代碼)

    PHP通過微信跳轉的Code參數(shù)獲取用戶的openid(關鍵代碼)

    這篇文章主要介紹了PHP通過微信跳轉的Code參數(shù)獲取用戶的openid(關鍵代碼)的相關資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下
    2016-07-07
  • thinkphp3.x中cookie方法的用法分析

    thinkphp3.x中cookie方法的用法分析

    這篇文章主要介紹了thinkphp3.x中cookie方法的用法,結合實例形式分析了thinkPHP中cookie方法的設置、獲取、刪除等常用操作技巧,需要的朋友可以參考下
    2016-05-05
  • Laravel重寫用戶登錄簡單示例

    Laravel重寫用戶登錄簡單示例

    這篇文章主要介紹了Laravel重寫用戶登錄的方法,結合簡單實例形式分析了Laravel框架根據(jù)已有的login方法重寫實現(xiàn)針對驗證碼、后臺登陸頻率及日志記錄的擴種等功能,需要的朋友可以參考下
    2016-10-10
  • PHP之header函數(shù)詳解

    PHP之header函數(shù)詳解

    這篇文章主要介紹了PHP之header函數(shù)詳解,小編覺得這個header函數(shù)的技術點還是比較重要的,感興趣的同學可以研究下
    2021-03-03

最新評論