phpbb的编辑器真是烂透了!于是我自己修改成了phpbb编辑器,并成功了!
首先下载编辑器下载地址:http://shanmao.me/f/ckeditor_3.6.2.zip
解压下载后的文件,把ckeditor文件夹复制到你的phpbb网站模板目录/styles\prosilver\template
找到phpbb模板编辑器所在位置:posting_editor.html
如果找不到posting_editor.html,找posting_body.html看看
首先引用编辑器js文件script type=”text/javascript” src=”{T_TEMPLATE_PATH}/ckeditor/ckeditor.js”></script
然后用ck编辑器替换现有编辑器的js代码:
CKEDITOR.replace(“message”);
在js里面使用上面代码就可以成功调用了
但是phpbb有个问题就是不支持html代码输出,也就是说,fck编辑器输出的所有信息是包含html代码的
phpbb并不解析这些代码,于是使用下面代码玩么解决编辑器html代码输出问题:
[code lang=”js”]
<script type="text/javascript">
<!–
CKEDITOR.replace("message",{
extraPlugins : ‘bbcode’,
toolbar :
[
[‘Source’, ‘-‘, ‘Save’,’NewPage’,’-‘,’Undo’,’Redo’],
[‘Find’,’Replace’,’-‘,’SelectAll’,’RemoveFormat’],
[‘Link’, ‘Unlink’, ‘Image’,’Flash’],
[‘Cut’,’Copy’,’Paste’,’PasteFromWord’],
‘/’,
[‘FontSize’, ‘Bold’, ‘Italic’,’Underline’,’StrikeThrough’,’Subscript’,’Superscript’],
[‘NumberedList’,’BulletedList’,’-‘,’Blockquote’],
[‘Alginleft’,’JustifyCenter’,’JustifyRight’,’JustifyBlock’,’-‘,’BidiLtr’,’BidiRtl’],
[‘TextColor’, ‘-‘, ‘Smiley’,’SpecialChar’, ‘-‘, ‘Maximize’]
],
});
//–>
</script>
[/code]
这里是使用了BBcode,你可以自定义你想要的bbcode,你可以添加,可以删除。我自己添加了很多参数上去。默认的没这么多。
因为这里调用了 toolbar ,所以你要写好对应的名称才可以调用相应的工具。
参考:
config.toolbar_Full =
[
{ name: ‘document’, items : [ ‘Source’,’-‘,’Save’,’NewPage’,’DocProps’,’Preview’,’Print’,’-‘,’Templates’ ] },
{ name: ‘clipboard’, items : [ ‘Cut’,’Copy’,’Paste’,’PasteText’,’PasteFromWord’,’-‘,’Undo’,’Redo’ ] },
{ name: ‘editing’, items : [ ‘Find’,’Replace’,’-‘,’SelectAll’,’-‘,’SpellChecker’, ‘Scayt’ ] },
{ name: ‘forms’, items : [ ‘Form’, ‘Checkbox’, ‘Radio’, ‘TextField’, ‘Textarea’, ‘Select’, ‘Button’, ‘ImageButton’, ‘HiddenField’ ] },
‘/’,
{ name: ‘basicstyles’, items : [ ‘Bold’,’Italic’,’Underline’,’Strike’,’Subscript’,’Superscript’,’-‘,’RemoveFormat’ ] },
{ name: ‘paragraph’, items : [ ‘NumberedList’,’BulletedList’,’-‘,’Outdent’,’Indent’,’-‘,’Blockquote’,’CreateDiv’,’-‘,’JustifyLeft’,’JustifyCenter’,’JustifyRight’,’JustifyBlock’,’-‘,’BidiLtr’,’BidiRtl’ ] },
{ name: ‘links’, items : [ ‘Link’,’Unlink’,’Anchor’ ] },
{ name: ‘insert’, items : [ ‘Image’,’Flash’,’Table’,’HorizontalRule’,’Smiley’,’SpecialChar’,’PageBreak’ ] },
‘/’,
{ name: ‘styles’, items : [ ‘Styles’,’Format’,’Font’,’FontSize’ ] },
{ name: ‘colors’, items : [ ‘TextColor’,’BGColor’ ] },
{ name: ‘tools’, items : [ ‘Maximize’, ‘ShowBlocks’,’-‘,’About’ ] }
];
查看详细API
很不幸的和大家说,有些BBcode 根本不能用,比如flash的。我也不知道为什么啊。。