提取fckeditor时,采用如下,php用$_post['p_info']得到fckeditor的值.
补充:
1 .此处basepath 的路径一定要和上面include的路径一样.否则会找不到文件)
另外,对于这个输入内容的变量,如果要把它存入数据库教程,它的变量名为你建立对象的名字.例如上面就是 p_info.
2. 在fckeditor/_samples/里面有个php教程调用的例子.如simples01.php和sampleposteddata.php这两个.后面那个文件是输出变量名的php程序,通过这个程序可以得到文本输入框内容的变量名.
3. 配置 fckeditor的toolbar功能按钮可以很容易地进行定制,你可以依据你的需要在fckeditor的配置文件fckeditor/fck_config.js中进行定制一个功能按钮对应一个唯一的名称.
在fck_config.js中默认情况下已经设定好三种toolbar样式:default(包含全部功能),accessibility和basic.
让我们先来看看toolbar样式的定制格式:
config.toolbarsets[toolbarsetname] = [ // toolbar名 ['item 1','item 2','-','item 3','item n'], // toolbar第一行 ['item 4','-','item 5','item 6','item n'] // toolbar第二行 ] ;
这里'-'的作用是创建一个分割条.
实例代码如下:
basepath = $basepath ;//fckeditor所在的位置 $fck -> toolbarset = 'news' ;//news为自定义的fckeditor工具栏名称 $fck -> width = '700' ;//长度 $fck -> height = '350' ;//高度 $fck -> config [ 'autodetectlanguage' ] = false ;//语言自动检测 $fck -> config [ 'defaultlanguage' ]= 'zh-cn' ;//语言 $content = $fck -> createhtml ();//创建fckeditor脚本文件 $smarty -> assign ( 'content' , $content ); $smarty -> display ( fck.tpl ); ?>
在smarty的文件中需要显示的地方:
默认的default包含了fckeditor的全部功能,个人感觉有些功能用不上,完全加载还会影响显示速度,所以我简化了一下,只加载了一些常用的功能:
1、打开fckeditor/fck_config.js文件
使用时只需把$ofckeditor->toolbarset = 'default' 改为$ofckeditor->toolbarset = 'www' 即可,最后,我们把fckeditor目录下所有以下划线_开头的目录都删掉以节省空间,如_test._samples.
文章网址:
随意转载^^但请附上教程地址。