SourceCodeSky QQ客服 SourceCodeSky 400电话 客服电话 暂无
首页 » 源代码 » 帝国CMS FCKeditor编辑器添加插入代码插件方法

帝国CMS FCKeditor编辑器添加插入代码插件方法

keepall
发布于2016-12-09 21:19:05
源码作者keepall
浏览次数:1890
下载次数:4
下载所需积分:10
源码分类 Tags:
代码插件方法插入添加CMS
源码分类 所属分类:
网页设计与交互 网页设计与交互 PHP PHP

分享有礼! 》

  • 请点击右侧的分享按钮,把本代码分享到各社交媒体。
  • 通过您的分享链接访问SourceCodeSky。
  • 分享推广源代码,每个源代码页面上,都有一组分享按钮。点击后,分享到您常用的社交媒体。通过您的分享链接访问本站,每来1个IP,您将获得1个积分。

代码介绍

 

帝国编辑器(FCK)默认是没有插入代码这一功能的,所以一般在添加代码的时候习惯用引用这个功能,可是,这也太不专业了吧?那咋整?就给FCK加一个插件呗。下面就是很有名的SyntaxHighlighter了。

首先大家可以去官网下载最新版,但是下载下来并不是就能用,还要进行一些配置,对新手来说是比较有难度的。这里可以直接使用恨雪提供的已经配置好的版本(2.1.382版本),本教程也是依据该版本而进行。

下载解压后是两个文件夹:

第一,上传SyntaxHighlighter2.1.382这个文件夹到网站根目录,或者其他你喜欢的地方,也可以重命名该文件夹,但是在后面模板文件中调用CSS和js的时候路径要对,这里我就传到根目录吧。

第二,把以下代码加到内容模板,这里就要注意第一步了。

复制代码
代码如下:

<script type=”text/javascript” src=”[!–news.url–]SyntaxHighlighter2.1.382/scripts/shCore.js”></script>
<script type=”text/javascript” src=”[!–news.url–]SyntaxHighlighter2.1.382/scripts/shBrushCss.js”></script>
<script type=”text/javascript” src=”[!–news.url–]SyntaxHighlighter2.1.382/scripts/shBrushJScript.js”></script>
<script type=”text/javascript” src=”[!–news.url–]SyntaxHighlighter2.1.382/scripts/shBrushXml.js”></script>
<script type=”text/javascript” src=”[!–news.url–]SyntaxHighlighter2.1.382/scripts/shBrushPhp.js”></script>
<script type=”text/javascript” src=”[!–news.url–]SyntaxHighlighter2.1.382/scripts/shBrushSql.js”></script>
<link type=”text/css” rel=”stylesheet” href=”[!–news.url–]SyntaxHighlighter2.1.382/styles/shCore.css”/>
<link type=”text/css” rel=”stylesheet” href=”[!–news.url–]SyntaxHighlighter2.1.382/styles/shThemeDefault.css”/>
<script type=”text/javascript”>
SyntaxHighlighter.config.clipboardSwf = ‘[!–news.url–]SyntaxHighlighter2.1.382/scripts/clipboard.swf';
SyntaxHighlighter.all();
</script>

值得一提的是,上面的这些shBrushSql.js之类的JS,并不是固定要调用这些的。这些JS都有其含义(brushes),可以看官方的文档。因为我比较经常用到css、html、php、sql,所以我就只写上面所示的js即可。当然,如果你愿意,你可以把全部的都调用上去。但是那样会很慢哦。但是,假设你没有调用php的,当你在插入代码的时候,语言选择php,那么在前台,会提示错误。(shCore.js一定要有,不然前台会没有效果)

第三,把syntaxhighlight2这个文件夹传到&ldquo;e/admin/ecmseditor/infoeditor/editor/plugins&rdquo;目录下,也就是说,这是FCK编辑器的一个插件。

第四,修改一下FCK编辑器的配置文件,需要编辑器添加一下插件和按钮。

1,后台配置文件路径:/e/admin/ecmseditor/infoeditor/fckconfig.js

2,前台配置文件路径:/e/data/ecmseditor/infoeditor/fckconfig.js

找到FCKConfig.PluginsPath = FCKConfig.BasePath + ‘plugins/’ ;      大概在51行

在下面插入

复制代码
代码如下:

FCKConfig.Plugins.Add(‘syntaxhighlight2′,’zh-cn’);
// default language options: c++,csharp,css,delphi,java,jscript,php,python,ruby,sql,vb,xhtml
FCKConfig.SyntaxHighlight2LangDefault =’c++';

然后找到’InsertTBr’],在  ‘InsertTBr’  后面输入   ,’SyntaxHighLight2’。

这样就算是完成了.

Sponsored links

源码文件列表

温馨提示: 点击源码文件名可预览文件内容哦 ^_^
...
名称 大小 修改日期
/syntaxhighlight2/fckplugin.js 1.95 KB 2009-05-23 12:48:24
/syntaxhighlight2/README.txt 1.68 KB 2009-05-23 14:03:52
/syntaxhighlight2/dialog/fck_syntaxhighlight.html 8.21 KB 2009-05-23 13:23:22
/syntaxhighlight2/dialog/syntaxhighlight.js 8.89 KB 2009-05-23 13:52:38
/syntaxhighlight2/docs/folder-setup.png 5.76 KB 2009-03-02 23:58:46
/syntaxhighlight2/docs/install.html 5.10 KB 2009-03-03 00:39:22
/syntaxhighlight2/docs/plugin-screenshot.png 4.66 KB 2009-03-02 23:56:04
/syntaxhighlight2/docs/styles.css 865 Bytes 2009-03-02 23:52:00
/syntaxhighlight2/images/syntaxhighlight.gif 94 Bytes 2009-03-02 21:49:52
/syntaxhighlight2/lang/en.js 2.29 KB 2009-05-23 12:43:00
/syntaxhighlight2/lang/zh-cn.js 1.51 KB 2013-10-22 11:33:40
/SyntaxHighlighter2.1.382/LGPLv3.txt 7.62 KB 2010-06-24 12:26:00
/SyntaxHighlighter2.1.382/test.html 2.06 KB 2010-06-24 12:26:00
/SyntaxHighlighter2.1.382/scripts/clipboard.swf 1.33 KB 2010-06-24 12:26:00
/SyntaxHighlighter2.1.382/scripts/shBrushAS3.js 2.85 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushBash.js 3.40 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushColdFusion.js 8.55 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushCpp.js 5.67 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushCSharp.js 2.98 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushCss.js 6.07 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushDelphi.js 2.84 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushDiff.js 1.54 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushErlang.js 2.16 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushGroovy.js 3.42 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushJava.js 2.56 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushJavaFX.js 2.67 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushJScript.js 2.17 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushPerl.js 3.61 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushPhp.js 5.59 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushPlain.js 1.24 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushPowerShell.js 4.34 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushPython.js 2.90 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushRuby.js 2.65 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushScala.js 2.38 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushSql.js 3.49 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushVb.js 2.73 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shBrushXml.js 2.46 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shCore.js 19.21 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/scripts/shLegacy.js 2.81 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/src/shCore.js 60.61 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/src/shLegacy.js 4.29 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/styles/help.png 786 Bytes 2010-06-24 12:26:00
/SyntaxHighlighter2.1.382/styles/magnifier.png 615 Bytes 2010-06-24 12:26:00
/SyntaxHighlighter2.1.382/styles/page_white_code.png 603 Bytes 2010-06-24 12:26:00
/SyntaxHighlighter2.1.382/styles/page_white_copy.png 309 Bytes 2010-06-24 12:26:00
/SyntaxHighlighter2.1.382/styles/printer.png 731 Bytes 2010-06-24 12:26:00
/SyntaxHighlighter2.1.382/styles/shCore.css 7.02 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/styles/shThemeDefault.css 3.44 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/styles/shThemeDjango.css 3.37 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/styles/shThemeEclipse.css 3.60 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/styles/shThemeEmacs.css 3.36 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/styles/shThemeFadeToGrey.css 3.42 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/styles/shThemeMidnight.css 3.37 KB 2010-06-24 12:26:04
/SyntaxHighlighter2.1.382/styles/shThemeRDark.css 3.39 KB 2010-06-24 12:26:04
ADS

资源评论

正在加载中……

Switch to the English version?

Yes
SourceCodeSky 英文版
No
SourceCodeSky 中文版

完善个人资料,获价值¥30元积分奖励!