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

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)文章

  • php隨機(jī)輸出名人名言的代碼

    php隨機(jī)輸出名人名言的代碼

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

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

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

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

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

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

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

    Ecshop 后臺(tái)添加新功能欄目及管理權(quán)限設(shè)置教程

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

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

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

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

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

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

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

    Laravel重寫用戶登錄簡(jiǎn)單示例

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

    PHP之header函數(shù)詳解

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

最新評(píng)論