在Drupal中集成FCKEditor

王朝other·作者佚名  2006-03-10
窄屏简体版  字體: |||超大  

首先对这两个到底是什么东西介绍一下,Drupal是一个多用户的BLOG系统,基于PHP+MySql,特点是比较灵活,而且非常小巧,大多数功能都靠插件来提供。FCKEditor是一个基于JSP的文字编辑器,现在CSDN的blog编辑器使用的就是这个工具,它可以直接在文档中插入图片,修改文字格式等等,这些都是所见即所得的。

Drupal中默认的文字编辑器功能比较单一,不太方便,正好Drupal中也有一个插件支持FCKEditor嵌入的,可以在这里找到 http://drupal.org/project/fckeditor ,但是非常不幸,在我的Drupal 4.6中安装后,在IE下一切表现良好,到了FireFox下,竟然显示出了一块白板,经过整整一下午跟代码,并在最后参考了CSDN上的调用方式后发现,这是由于调用时的路径造成的,CSDN上使用了绝对路径,而Drupal的这个插件中使用了相对路径,最后,把插件使用的FCKEditor代码搬到www的根目录下,并采用绝对路径进行调用,一切问题解决。

最后贴一下修改的相关代码:

fckeditor.module

function fckeditor_create_editor($name) {

$html = '';

//$base_path = variable_get("fckeditor_base_path", 'modules/fckeditor/lib/');

$base_path = "/fckeditor/lib/";

$link = "$base_path" . "editor/fckeditor.html?InstanceName=edit-$name";

$link .= '&Toolbar=' . variable_get("fckeditor_toolbar", 'Default');

$height = variable_get("fckeditor_height", '500');

$width = variable_get("fckeditor_width", '100%');

// Render the configurations hidden field.

$html .= '<input type="hidden" id="edit-';

$html .= $name;

$html .= '___Config" value="';

//$html .= fckeditor_config_string();

$html .= '">';

// Render the editor IFRAME.

$html .= '<iframe id="edit-';

$html .= $name;

$html .= '___Frame" src="';

$html .= $link;

$html .= "\" width=\"$width\" height=\"$height\" frameborder=\"no\" scrolling=\"no\"></iframe>" ;

return $html;

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航