- 浏览: 13731229 次
- 性别:
- 来自: 洛杉矶
文章分类
- 全部博客 (1994)
- Php / Pear / Mysql / Node.js (378)
- Javascript /Jquery / Bootstrap / Web (435)
- Phone / IOS / Objective-C / Swift (137)
- Ubuntu / Mac / Github / Aptana / Nginx / Shell / Linux (335)
- Perl / Koha / Ruby / Markdown (8)
- Java / Jsp (12)
- Python 2 / Wxpython (25)
- Codeigniter / CakePHP (32)
- Div / Css / XML / HTML5 (179)
- WP / Joomla! / Magento / Shopify / Drupal / Moodle / Zimbra (275)
- Apache / VPN / Software (31)
- AS3.0/2.0 / Flex / Flash (45)
- Smarty (6)
- SEO (24)
- Google / Facebook / Pinterest / SNS (80)
- Tools (22)
最新评论
-
1455975567:
xuezhongyu01 写道wocan23 写道我想问下那个 ...
Mysql: LBS实现查找附近的人 (两经纬度之间的距离) -
xuezhongyu01:
wocan23 写道我想问下那个111.1是怎么得来的我也看不 ...
Mysql: LBS实现查找附近的人 (两经纬度之间的距离) -
18335864773:
试试 pageoffice 在线打开 PDF 文件吧. pag ...
jquery在线预览PDF文件,打开PDF文件 -
青春依旧:
opacity: 0.5; 个人喜欢这种方式!关于其他css特 ...
css透明度的设置 (兼容所有浏览器) -
July01:
推荐用StratoIO打印控件,浏览器和系统的兼容性都很好,而 ...
搞定网页打印自动分页问题
Using CKEditor as a plugin in your CodeIgniter applications
CKEditor is a powerfull WYSIWYG text editor licensed under the GPL, LGPL and MPL open source licenses. CKEditor can easilly be added to any web page, you will find below a simple way to integrate CKeditor to your CodeIgniter applications .
Downloading CKEditor
The first step is to download the CKEditor editor package , note that the helper have only be tested over CKEditor 3.0.2. Once done, you should consider to remove the _samples and _sources directories from the uncompressed files.
Then, place the entire ckeditor directory into a /js/ folder. You can place it anywhere but remember to set the correct path when initializing the helper.
Adding the CKEditor helper for CodeIgniter
Download and place the ckeditor_helper.php file into the CodeIgniter’s system/application/helpers folder.
This helper can, for the moment, manage all CKEditor’s available configuration options and custom styles definitions .
Creating the controller
First of all, we are going to create a controller that will set all the helper’s configuration options. You are able to set all CKEditor’s available configuration options inside the config array. We are also going to define two custom styles to replace the CKEditor’s default styles. Note that the id must match the textarea’s id in the view.
<?php class Ckeditor extends Controller { public $data = array(); public function __construct() { parent::Controller(); $this->load->helper('url'); //You should autoload this one ;) $this->load->helper('ckeditor'); //Ckeditor's configuration $this->data['ckeditor'] = array( //ID of the textarea that will be replaced 'id' => 'content', // Must match the textarea's id 'path' => 'js/ckeditor', // Path to the ckeditor folder relative to index.php //Optionnal values 'config' => array( 'toolbar' => "Full", //Using the Full toolbar 'width' => "550px", //Setting a custom width 'height' => '100px', //Setting a custom height ), //Replacing styles from the "Styles tool" 'styles' => array( //Creating a new style named "style 1" 'style 1' => array ( 'name' => 'Blue Title', 'element' => 'h2', 'styles' => array( 'color' => 'Blue', 'font-weight' => 'bold' ) ), //Creating a new style named "style 2" 'style 2' => array ( 'name' => 'Red Title', 'element' => 'h2', 'styles' => array( 'color' => 'Red', 'font-weight' => 'bold', 'text-decoration' => 'underline' ) ) ) ); } public function index() { $this->load->view('ckeditor', $this->data); } }
Creating the view
The ckeditor.php view only has to display a textarea element with the matched id and call the display_ckeditor() helper’s function.
<textarea name="content" id="content" ><p>Example data</p></textarea> <?php echo display_ckeditor($ckeditor); ?>
That’s all ! If you’ve followed all the steps correctly, CKEditor should shows up in the view. Please note that I assume that you are loading also a correct header and footer view with all the xHTML required stuff.
Downloading the tutorial
Source files of this tutorial (controller, helper, and view) can be downloaded here .
第二种方法:
Minimized version:
ckeditor_helper.php
<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); function form_ckeditor($data) { return < script type="text/javascript" src="'.base_url().'application/plugins/ckeditor/ckeditor.js"></script>' . '<script type="text/javascript">CKEDITOR.replace("'.$data['id'].'");</script>'; }
To use:
echo form_ckeditor(array('id'=>'textarea_id'));
With many parameters and personalized thinks...
ckeditor_helper.php
<?php if(!defined('BASEPATH')) exit('No direct script access allowed'); function form_ckeditor($data) { $data['language'] = isset($data['language']) ? $data['language'] : 'es'; $size = isset($data['width']) ? 'width: "'.$data['width'].'", ' : ''; $size .= isset($data['height']) ? 'height: "'.$data['height'].'", ' : ''; $options = '{'. $size. 'language: "'.$data['language'].'", stylesCombo_stylesSet: "my_styles", startupOutlineBlocks: true, entities: false, entities_latin: false, entities_greek: false, forcePasteAsPlainText: false, filebrowserImageUploadUrl : "filexplorers/fckeditor_upload/image", // << My own file uploader filebrowserImageBrowseUrl : "filexplorers/inlinebrowse/image", // << My own file browser filebrowserImageWindowWidth : "80%", filebrowserImageWindowHeight : "80%", toolbar :[ ["Source","-","FitWindow","ShowBlocks","-","Preview"], ["Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"], ["Cut","Copy","Paste","PasteText","PasteWord","-","Print","SpellCheck"], ["Form","Checkbox","Radio","TextField","Textarea","Select","Button","ImageButton","HiddenField"], ["About"], "/", ["Bold","Italic","Underline"], ["OrderedList","UnorderedList","-","Blockquote","CreateDiv"], ["Image","Flash","Table"], ["Link","Unlink","Anchor"], ["Rule","SpecialChar"], ["Styles"] ] }'; $my_styles = 'CKEDITOR.addStylesSet("my_styles", [ // Block Styles { name : "H3", element : "h3"}, { name : "Heading 4", element : "h4"}, { name : "Heading 5", element : "h5"}, { name : "Heading 6", element : "h6"}, { name : "Document Block", element : "div"}, { name : "Preformatted Text", element : "pre"}, { name : "Address", element : "address"}, // Inline Styles { name: "Centered paragraph", element: "p", attributes: { "class": "center" } }, { name: "IMG bordered", element: "img", attributes: { "class": "bordered" } }, { name: "IMG left", element: "img", attributes: { "class": "left" } }, { name: "IMG right", element: "img", attributes: { "class": "right" } }, { name: "IMG left bordered", element: "img", attributes: { "class": "left bordered" } }, { name: "IMGright bordered", element: "img", attributes: { "class": "right bordered" } }, ]);'; return // fix: move to <HEAD... '<script type="text/javascript" src="'.base_url().'application/plugins/ckeditor/ckeditor.js"></script>' . // put the CKEditor '<script type="text/javascript">' . $my_styles . 'CKEDITOR.replace("'.$data['id'].'", ' . $options . ');</script>'; }
To use:
echo form_ckeditor(array( 'id' => 'textarea_id', 'width' => '500', 'height' => '300', 'value' => htmlentities($textarea_value) ));
Look at CodeIgniter forum: <!-- m -->http://codeigniter.com/forums/viewthread/127374/ <!-- m -->
- CKEditor.zip (3.6 KB)
- 下载次数: 18
发表评论
-
CakePHP你必须知道的21条技巧
2012-10-19 06:25 1882原文链接:http://www.avatarfinancial ... -
cakephp 1.3 Views
2012-10-09 06:12 1442Section 1 Views 视图 一个vie ... -
cakephp 1.3 Models
2012-10-09 06:07 2501Section 1 What is a model? ... -
cakephp 1.3 Controller
2012-10-09 05:49 3333Controller 一个controller用于管理 ... -
cakephp 1.3 配置CakePHP
2012-10-09 05:31 4644Section 1 数据库配置 app/config/ ... -
CakePHP 2.x十分钟博客教程
2012-10-07 01:27 244131. CakePHP2十分钟博客教 ... -
Create an Admin panel with CodeIgniter
2010-05-23 02:15 4175Create an Admin panel with Code ... -
Codeigniter Grid 使用方法 (flexigrid)
2010-05-23 02:05 2803来源:http://codeigniter.com/forum ... -
CI集成 ckeditor 配置
2010-05-23 01:34 3752配置 ckeditor 1.上传 下载 ckedito ... -
codeigniter 辅助函数 - 敏感词过滤
2010-05-05 06:18 4575我们都知道有些敏感的词汇是不适合出现在互联网上的,特别是在有用 ... -
实现简单 codeigniter 缓存 (cache)
2010-04-30 23:47 5278代码 class Test extends Contr ... -
codeigniter 生成 excel
2010-04-19 00:33 3323Excel Plugin Th ... -
CakePHP 中文手册
2010-04-14 21:04 2336基本概念 Section1 简介 ... -
利用 Cache_Lite代替codeigniter中的cache功能
2010-01-29 06:15 5509codeigniter的功能纵然强大,也有不足之处。其cach ... -
CodeIgniter 操作PDF ( Generating PDF files using CodeIgniter )
2010-01-03 04:03 3608PDF files rock! Some of the p ... -
CodeIgniter 合作 Authorize.net
2009-12-30 00:25 1612function payment(){ // 略... ... -
CodeIgniter 合作paypal
2009-12-30 00:15 2352<?php class Paypal extend ... -
CodeIgniter 操作 CSV
2009-12-29 07:17 4633A Comma separated values (CSV) ... -
codeigniter 操作 Rss
2009-12-29 07:12 1970I wrote a codeigniter library t ... -
codeigniter操作xml
2009-12-29 06:57 3993This Simplexml class provides a ...
相关推荐
CKeditor for JAVA v3.6.4是一款专为JAVA开发者设计的在线网页编辑器,它提供了丰富的文本编辑功能,使得用户可以在浏览器环境下实现所见即所得(WYSIWYG)的编辑体验。这款编辑器不仅限于JAVA平台,还兼容多种...
"CKEditor for Zen Cart v1.xx" 是专门为Zen Cart电子商务系统定制的一个版本,确保了与Zen Cart的无缝集成和兼容性。 Zen Cart是一款开源的在线商店管理系统,基于PHP语言和MySQL数据库,它为商家提供了一个功能...
在本资源"CKEditor3.6.2 for java"中,重点是将CKEditor与Java环境集成,特别是针对Eclipse开发环境的配置。以下是关于这个主题的详细知识点: 1. **CKEditor 3.6.2**: 这是CKEditor的一个特定版本,发布于2010年,...
CKEditor 3.6.2 for Java版主要包含以下组件: 1. WAR包:WAR(Web Application Archive)是Java Web应用程序的标准打包格式,可以直接部署在支持Servlet容器(如Tomcat、Jetty)上。这个WAR文件包含了完整的...
在"CKeditor for ASP.NET"的项目中,提供的文件包含以下关键知识点: 1. **LICENSE.html**:此文件通常包含了软件的许可协议,详细规定了用户如何合法地使用、修改和分发CKeditor的源代码。对于开发者来说,理解...
CKEditor3.6.4+CKFinder2.3 for java破解整合
是一个专门使用在网页上属于开放源代码的所见即所得文字编辑器。它志于轻量化,不需要太复杂的安装步骤即可使用。...“FCKeditor”名称中的“FCK” 是这个编辑器的作者的名字Frederico Caldeira Knabben的缩写。
Finder for java2.1可能是与CKEditor集成的一个工具或库,用于帮助开发者更方便地在Java环境中管理和使用CKEditor。 在Java Web开发中,CKEditor通常通过JavaScript在客户端运行,而服务器端则处理CKEditor提交的富...
CKeditor是一款在线网页编辑插件(用浏览器编辑后所见即所得),支持多种平台下的脚本(asp aspx php cfm Dhtml htc),还集成了上传图片组件,含简、繁中文 CKeditor for joomla1.7兼容JOOMLA!1.5以上。 易于安装和...
在ASP.NET应用中,CKEditor5是一款常用的富文本编辑器,它提供了丰富的文本格式化功能,包括图片上传。本文将详细介绍如何在ASP.NET环境中集成CKEditor5并实现图片上传功能。 首先,我们需要在项目中引入CKEditor5...
带Ckeditor和KCFinder的Codeigniter 3 与和使用会话authenctication 设置 下载, , 主文件 认沽 , 你文件。 例如,我创建资产目录。 配置1 在根目录上打开index.php CI文件并修改一些行 $application_folder = '...
CKEditor 是一个流行的富文本编辑器,广泛应用于Web开发中,提供丰富的文本格式化和多媒体插入功能。在Java环境中,CKEditor 可以被集成到Web应用中,以支持用户在网页上编辑内容,比如发布文章或填充表单。本文将...
**ckeditor for java 模板项目** CKEditor是一款流行的富文本编辑器,广泛应用于网页和应用程序中,提供丰富的文本格式化和编辑功能。在Java环境中,CKEditor可以通过与Servlet或JSP页面结合,使得用户能够在服务器...
这个开源的HTML文本编辑器可以让Web程序拥有如MS Word这样强大的编辑功能. FCKeditor支持当前流行的浏览器如IE,Firefox,Netscape,Opera等. 在线网页编辑插件(用浏览器编辑后所见即所得),支持多种平台下的脚本(asp ...
CKEditor4是一款流行的富文本编辑器,广泛应用于Web开发中,提供丰富的文本格式化功能,如插入图片、链接、表格等。在.NET框架下,CKEditor4可以与ASP.NET结合,实现用户友好的内容编辑界面。这个压缩包提供的是一套...
CKeditor是一款在线网页编辑插件(用浏览器编辑后所见即所得),支持多种平台下的脚本(asp aspx php cfm Dhtml htc),还集成了上传图片组件,含简、繁中文 ...CKeditor for Drupal 7兼容Drupal 7。
在这个“ckeditor带上传例子 for java jsp”的压缩包中,包含了一个基于Java和JSP的CKEditor上传功能示例。 首先,我们需要理解CKEditor的上传功能。在CKEditor中,用户可以插入图片、文件或其他媒体内容,而上传...
CKEditor for Java Integration Guide 在 jsp 中通过自定义标签调用
CKEditor 4.0这是 CKEditor 一个非常好的、稳定的版本,与CKFinder(已破解)实现了图片上传等功能,并且还对文本显示问题进行了编辑,个人觉得很好用,给大家分享下吧。大家也可以进行自己的修改。例如 BiDi 支持、...