一、在调用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"