CI框架中集成CKEditor編輯器的教程
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、在項(xiàng)目中使用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 );
?>
相關(guān)文章
laravel5.5安裝jwt-auth 生成token令牌的示例
今天小編就為大家分享一篇laravel5.5安裝jwt-auth 生成token令牌的示例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2019-10-10Bootstrap+PHP實(shí)現(xiàn)多圖上傳功能實(shí)例詳解
這篇文章主要介紹了Bootstrap+PHP實(shí)現(xiàn)多圖上傳功能實(shí)例詳解,本文圖片加實(shí)例相結(jié)合的形式給大家介紹的非常詳細(xì),需要的朋友可以參考下2018-04-04php實(shí)現(xiàn)ffmpeg處理視頻的實(shí)踐
本文主要介紹了php實(shí)現(xiàn)ffmpeg處理視頻的實(shí)踐,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-12-12Ecshop 后臺(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)中的方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-10-10PHP通過(guò)微信跳轉(zhuǎn)的Code參數(shù)獲取用戶的openid(關(guān)鍵代碼)
這篇文章主要介紹了PHP通過(guò)微信跳轉(zhuǎn)的Code參數(shù)獲取用戶的openid(關(guān)鍵代碼)的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2016-07-07