標籤:insert range type=file javascrip example win .com rup form
一:前端頁面代碼
<script src="/www/res/ckeditor/ckeditor.js"></script><textarea id="articlecontent" ><?php echo $request[‘content‘]; ?></textarea><script type="text/javascript"> $(‘#articlecontent‘).ckeditor({ customConfig : ‘config_user.js‘ });</script>
其中上面的config_user.js是使用者自訂設定檔,內容如下:
CKEDITOR.editorConfig = function( config ) { // The toolbar groups arrangement, optimized for two toolbar rows. config.toolbarGroups = [ { name: ‘clipboard‘, groups: [ ‘clipboard‘, ‘undo‘ ] }, { name: ‘editing‘, groups: [ ‘find‘, ‘selection‘, ‘spellchecker‘ ] }, { name: ‘links‘ }, { name: ‘insert‘ }, { name: ‘forms‘ }, { name: ‘tools‘ }, { name: ‘document‘, groups: [ ‘mode‘, ‘document‘, ‘doctools‘ ] }, { name: ‘others‘ }, { name: ‘basicstyles‘, groups: [ ‘basicstyles‘, ‘cleanup‘ ] }, { name: ‘paragraph‘, groups: [ ‘list‘, ‘indent‘, ‘blocks‘, ‘align‘, ‘bidi‘ ] }, { name: ‘styles‘ }, { name: ‘colors‘ }, { name: ‘about‘ } ]; // Remove some buttons provided by the standard plugins, which are // not needed in the Standard(s) toolbar. config.removeButtons = ‘Underline,Subscript,Superscript‘; // Set the most common block elements. config.format_tags = ‘p;h1;h2;h3;pre‘; // Simplify the dialog windows. config.removeDialogTabs = ‘image:advanced;link:advanced‘; //自訂配置 //config.配置項 = 值 config.width = 800; config.height = 300; config.uiColor = "#aabbcc"; //檔案的上傳管理:載入CKfinder 注意檔案路徑為網站根目錄 使用時,注意ckfinder檔案安裝路徑 config.filebrowserBrowseUrl = ‘/www/res/ckfinder/ckfinder.html‘; config.filebrowserImageBrowseUrl = ‘/www/res/ckfinder/ckfinder.html?Type=Images‘; config.filebrowserFlashBrowseUrl = ‘/www/res/ckfinder/ckfinder.html?Type=Flash‘; config.filebrowserUploadUrl = ‘/www/res/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files‘; config.filebrowserImageUploadUrl = ‘/www/res/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images‘; config.filebrowserFlashUploadUrl = ‘/www/res/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash‘;};
二:ckeditor檔案安裝,
注意因為在ckeditor中已經自訂了設定檔,注意裡面配置的與ckfinder檔案的相對位置
三:ckfinder檔案安裝
需要配置上傳檔案的儲存路徑,在ckfinder檔案夾下的config.php檔案中修改
$baseUrl = ‘http://www.example.com/www/articlesuploads/‘;
設定檔案的儲存路徑
PHP ckeditor富文字編輯器 結合ckfinder實現圖片上傳功能