在线编辑器tinymce与文件上传插件kcfinder的集成

一、在调用tinymce的javascript中加入:

tinyMCE.init({
   
file_browser_callback: 'openKCFinder',
    ...........
    ...........
});

二、定义函数penKCFinder:

functionopenKCFinder(field_name, url, type, win){
   
tinyMCE.activeEditor.windowManager.open({
       
file: '/kcfinder/browse.php?opener=tinymce&type=' + type, //根据kcfinder实际所在目录
       
title: 'KCFinder',
       
width: 700,
       
height: 500,
       
resizable: "yes",
       
inline: true,
       
close_previous: "no",
       
popup_css: false
   
}, {
       
window: win,
       
input: field_name
   
});
   
returnfalse;
}

三、修改kcfinder的config.php,指定文件上传路径:

..........

$upurl ="http://www.cnblogs.com/../upload/".date('Y'); // 加上年目录
//echo $upurl;
if (!is_dir($upurl))
    mkdir($upurl,0777);
$upurl =$upurl.date('/m'); // 加上月目录  
//echo $upurl;
if (!is_dir($upurl))
    mkdir($upurl,0777);

$_CONFIG = array(

    'disabled' => false,

    ..........

    'theme' => "oxygen",

    'uploadURL' =>$upurl,     'uploadDir' => "",

..................

四、添加汉字字体

在TinyMCE/Theme子目录中的Advanced下修改文件editor_template.js:修改其中内容:

theme_advanced_fonts:"\u5b8b\u4f53=\u5b8b\u4f53;\u6977\u4f53=\u6977\u4f53;\u9ed1\u4f53=\u9ed1\u4f53;\u4eff\u5b8b=\u4eff\u5b8b;\u96b6\u4e66=\u96b6\u4e66;\u5e7c\u5706=\u5e7c\u5706;\u5fae\u8f6f\u96c5\u9ed1=\u5fae\u8f6f\u96c5\u9ed1"

 

 

 

 

 

 

 

 

 

 

 

 

 

转载于:https://www.cnblogs.com/wxb-km/archive/2012/08/25/2655761.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值