phpcms2008 kindeditor替换fckeditor文本编辑器支持视频上传功能

编程开发 代码 2621浏览

一、下载kindeditor最新版版本 放到更目录下;

二、在根目录下include文件中打开 form.class.php将

global $PHPCMS, $mod, $file, $catid, $_userid;
$str = “<script type=\”text/javascript\” src=\”fckeditor/fckeditor.js\”></script>\n<script language=\”JavaScript\” type=\”text/JavaScript\”>var SiteUrl = \””.SITE_URL.”\”; var Module = \””.$mod.”\”; var sBasePath = \””.SITE_URL.”\” + ‘fckeditor/’; var oFCKeditor = new FCKeditor( ‘”.$textareaid.”‘ ) ; oFCKeditor.BasePath = sBasePath ; oFCKeditor.Height = ‘”.$height.”‘; oFCKeditor.Width    = ‘”.$width.”‘ ; oFCKeditor.ToolbarSet    = ‘”.$toolbar.”‘ ;oFCKeditor.ReplaceTextarea();”;
if($_userid && $isshowext)
{
$str .= “editor_data_id += ‘”.$textareaid.”|’;if(typeof(MM_time)==’undefined’){MM_time = setInterval(update_editor_data,”.($PHPCMS[‘editor_interval_data’]*1000).”);}”;
}

大约 6到11行 替换成:

$str .= ‘<script charset=”utf-8″ type=”text/javascript” src=”kindeditor/kindeditor.js”></script>’;
$str .= ‘<script charset=”utf-8″ type=”text/javascript” src=”kindeditor/kindeditor-min.js”></script>’;
$str .= ‘<script charset=”utf-8″ type=”text/javascript” src=”kindeditor/lang/zh_CN.js”></script>’;
define(‘EDITOR_INIT’, 1);
$str .= “<script type=\”text/javascript\”>\r\n”;
$str .= “KindEditor.ready(function(K) {\r\n”;
$str .= “editor = K.create(‘textarea[id=\”$textareaid\”]‘, {\r\n”;
$str .= “allowFileManager : true,\r\n”;
$str .= “width : ’99%’,”;
$str .= “height : ’400px’”;
$str .= “});”;
$str .= “});”;
$str .= ‘</script>’;

三、修改kindeditor\php 中file_manager_json.php 和 upload_json.php 中的路径将

$root_path = $php_path . ‘../attached/’;
//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
$root_url = $php_url . ‘../attached/’;

替换为:

$root_path = $php_path . ‘../../uploadfile/’;
//根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/
$root_url = $php_url . ‘../../uploadfile/’;

这样图片和文件的上传就搞定了。

上传视频

这个是做好的其中带有上传视频的功能;

kindeditor

1、其中要注意的是kindeditor\plugins\flash中flash.js  大约69 行  src : ‘/phpcms/kindeditor/plugins/jwplayer/player.swf’,

根据需要自己改动;

2、修改配置文件 php.ini  中的 post_max_size = 100M  和 upload_max_filesize = 100M     多大可以自行调整;

3、编辑器中的flash 就具备了本地上传视频的功能了。

转载请注明:代码'S Blog » phpcms2008 kindeditor替换fckeditor文本编辑器支持视频上传功能