php调用ckeditor?怎么调用ckeditor
PHP调用FCKeditor
将FCKeditor放在网站根目录
在PHP文件里面,包含/FCKeditor/ckeditor/" target="_blank">fckeditor.php文件
在网页中需要放置该编辑器的地方插入下面代码即可调用:
<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy3915')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy3915> <?php//包含fckeditor类
include("fckeditor/fckeditor.php") ;
//创建一个FCKeditor,表单名称为 jzleditor
$oFCKeditor = new FCKeditor("jzleditor");
//设置编辑器路径
$oFCKeditor->BasePath = "fckeditor/";
$oFCKeditor->ToolbarSet = "Default";//工具按钮
$oFCKeditor->Value =$cont; //;设置初始内容
$oFCKeditor->Width="100%"; //设置它的宽度
$oFCKeditor->Height="550px"; //设置它的高度
$oFCKeditor->Create();
?>
输入内容,提交后,在处理的文件中通过$_POST["jzleditor"]来取得输入的内容
js调用FCKeditor
CKEDITOR的使用很简单,先download CKEDITOR 3.6.1(默认是PHP版的),然后在调用页面的head中,写下如下两段js:
<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy9431')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy9431><script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script type="text/javascript"> window.onload = function()
{
CKEDITOR.replace( "content" );
};
</script>
注意:这里的content是<textarea>的名称,如下所示:
<textarea name="content">ddd</textarea>如果是3.6.2版本,该语句可能要写成:
<textarea name="content" class="ckeditor">ddd</textarea>
版本差异造成的问题,请大家在运行时注意这个问题。
在下一个页面根据name值content获取相应的值
您可能感兴趣的文章:
php调用ckeditor?怎么调用ckeditor
PHP中Ckeditor Ckfinder配置图片上传功能
JQuery获取或设置ckeditor的数据(示例代码)
javascript获取ckeditor编辑器中值的方法
php ckeditor上传图片文件名乱码解决方法
php CKFinder上传中文名文件乱码问题的解决方法
php ckeditor编辑器文章分页实现方法
CKEditor CKFinder php上传文件配置方法
php实现百度网盘图片直链的代码分享
ckeditor上传文件重命名并加水印配置方法