官方网址下载的wordPress,其编辑器为文本框,由javascript控制实现,存在图像和源代码不能发布。
今天把FCKeditor编辑器整合到wordPress,效果不错(更新于 2007-04-13)。
最新wordpress2.0以上版本整合FCKeditor编辑器提供下载地址,
此次更新主要方便于大家的使用,只要按照里面的说明文档操作,只要上传几个文件就可以了,很简单。
wordpress2.0以下的版本请按照 以下二步为流程操作:
一、在这三个程序加入以下代码:
(注:请先将以下要替换的代码复制到文本编辑器里,不能直接放在Dreamweaver,因为“< >”通过这编辑器转成“< >” )
(如果没对/wp-admin/修改,可下载wp-admin.rar,解压缩里面三个文件直接覆盖)
/wp-admin/edit-form.php
第一行加入:
<?php
include("../FCKeditor/fckeditor.php") ;
?>
大概第42行:
把 <textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $post->post_content ?> </textarea>替换成以下代码:
<?php
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// $oFCKeditor->BasePath = ‘/FCKeditor/’ ; // ‘/FCKeditor/’ is the default value.
$sBasePath = $_SERVER['PHP_SELF'] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
$oFCKeditor = new FCKeditor(’content’) ;
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->Value = $post->post_content;
$oFCKeditor->Create() ;
?>
删除以下代码:
<script type="text/javascript">
<!–
edCanvas = document.getElementById(’content’);
//–>
</script>
/wp-admin/edit-form-advanced.php
第一行加入:
<?php
include("../FCKeditor/fckeditor.php") ;
?>
大概在155行:
把 <textarea <?php if ( user_can_richedit() ) echo ‘title="true" ‘; ?>rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="2" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea>
替换代码:
<?php
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// $oFCKeditor->BasePath = ‘/FCKeditor/’ ; // ‘/FCKeditor/’ is the default value.
$sBasePath = $_SERVER['PHP_SELF'] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
$oFCKeditor = new FCKeditor(’content’) ;
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->Value = user_can_richedit() ? ($post->post_content) : $post->post_content;
$oFCKeditor->Create() ;
?>
/wp-admin/edit-page-form.php
第一行加入:
<?php
include("../FCKeditor/fckeditor.php") ;
?>
大概在136行: 把 <textarea title="true" rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo user_can_richedit() ? wp_richedit_pre($post->post_content) : $post->post_content; ?></textarea>
替换代码:
<?php
// Automatically calculates the editor base path based on the _samples directory.
// This is usefull only for these samples. A real application should use something like this:
// $oFCKeditor->BasePath = ‘/FCKeditor/’ ; // ‘/FCKeditor/’ is the default value.
//wp_richedit_pre
$sBasePath = $_SERVER['PHP_SELF'] ;
$sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
$oFCKeditor = new FCKeditor(’content’) ;
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->Value = user_can_richedit() ? ($post->post_content) : $post->post_content;
$oFCKeditor->Create() ;
?>
二、下载FCKeditor, 把FCKeditor.rar里的文件解压缩到根目录下: /FCKeditor/