设为首页 - 加入收藏 - 网站地图 欢迎加QQ群 :14364084

织梦5.7(dedecms) 在ckeditor上安装SyntaxHighlighter代码高

时间:2013-03-04 14:26 来源:谭博的博客 标签:ckeditor集成SyntaxHighlighter ckeditor+SyntaxHighlighter 作者:谭博 阅读:

 

第一步
 
在"\include\inc\inc_fun_funAdmin.php"(179行)找到:
$config['extraPlugins'] = 'dedepage';
改为
$config['extraPlugins'] = 'dedepage,syntaxhighlight';
 
第二步
 
http://www.tanbo.name/uploads/syntaxhighlight.rar解压 放入include\ckeditor\plugins即可
 
 
第三步
 
前台显示
 
下载 http://www.tanbo.name/images/syntaxhighlight.rar    解压至/images
 
然后在文章内容页加入如下代码
 
<script type='text/javascript' src='/images/syntaxhighlighter/scripts/shCore.js?ver=2.1.364'></script>
<script type='text/javascript' src='/images/syntaxhighlighter/scripts/shBrushPhp.js?ver=2.1.364'></script>
<script type='text/javascript'>
	(function(){
		var corecss = document.createElement('link');
		var themecss = document.createElement('link');
		var corecssurl = "/images/syntaxhighlighter/styles/shCore.css?ver=2.1.364";
		if ( corecss.setAttribute ) {
				corecss.setAttribute( "rel", "stylesheet" );
				corecss.setAttribute( "type", "text/css" );
				corecss.setAttribute( "href", corecssurl );
		} else {
				corecss.rel = "stylesheet";
				corecss.href = corecssurl;
		}
		document.getElementsByTagName("head")[0].insertBefore( corecss, document.getElementById("syntaxhighlighteranchor") );
		var themecssurl = "/images/syntaxhighlighter/styles/shThemeDefault.css?ver=2.1.364";
		if ( themecss.setAttribute ) {
				themecss.setAttribute( "rel", "stylesheet" );
				themecss.setAttribute( "type", "text/css" );
				themecss.setAttribute( "href", themecssurl );
		} else {
				themecss.rel = "stylesheet";
				themecss.href = themecssurl;
		}
		//document.getElementById("syntaxhighlighteranchor").appendChild(themecss);
		document.getElementsByTagName("head")[0].insertBefore( themecss, document.getElementById("syntaxhighlighteranchor") );
	})();
	SyntaxHighlighter.config.clipboardSwf = '/images/syntaxhighlighter/scripts/clipboard.swf';
	SyntaxHighlighter.config.strings.expandSource = 'show source';
	SyntaxHighlighter.config.strings.viewSource = '查看源代码';
	SyntaxHighlighter.config.strings.copyToClipboard = '复制到剪贴板(用火狐会卡比哦)';
	SyntaxHighlighter.config.strings.copyToClipboardConfirmation = '代码现在在你的剪贴板';
	SyntaxHighlighter.config.strings.print = '打印';
	SyntaxHighlighter.config.strings.help = '帮助';
	SyntaxHighlighter.config.strings.alert = 'SyntaxHighlighter\n\n';
	SyntaxHighlighter.config.strings.noBrush = '无法找到Brush:';
	SyntaxHighlighter.config.strings.brushNotHtmlScript = 'Brush不能设置 html-script选项';
	SyntaxHighlighter.defaults['pad-line-numbers'] = false;
	SyntaxHighlighter.all();
</script>

 

关注微信公众号

微信扫一扫,打赏我

热评文章
    内容不错,支持一下
    评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)