1.下载
[url]http://alexgorbatchev.com/SyntaxHighlighter/download/[/url]
2.引入(cakephp代码), 注意这里的问题:[url]http://blog.blakesimpson.co.uk/read/5-installing-syntaxhighlighter-error-xregexp-not-defined[/url]
[color=darkblue]
echo $this->Html->css("/js/plugins/syntaxhighlighter/styles/shCore");//基础
echo $this->Html->css("/js/plugins/syntaxhighlighter/styles/shCoreDefault");//可以换成其他样式
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shCore");//基础
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shAutoloader");//基础
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shLegacy");//基础
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shBrushCss");//支持的语言
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shBrushJava");//支持的语言
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shBrushJScript");//支持的语言
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shBrushPhp");//支持的语言
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shBrushXml");//支持的语言
[/color]
3.定义要格式化的代码
4.初始化
[url]http://alexgorbatchev.com/SyntaxHighlighter/download/[/url]
2.引入(cakephp代码), 注意这里的问题:[url]http://blog.blakesimpson.co.uk/read/5-installing-syntaxhighlighter-error-xregexp-not-defined[/url]
[color=darkblue]
echo $this->Html->css("/js/plugins/syntaxhighlighter/styles/shCore");//基础
echo $this->Html->css("/js/plugins/syntaxhighlighter/styles/shCoreDefault");//可以换成其他样式
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shCore");//基础
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shAutoloader");//基础
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shLegacy");//基础
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shBrushCss");//支持的语言
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shBrushJava");//支持的语言
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shBrushJScript");//支持的语言
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shBrushPhp");//支持的语言
echo $this->Html->script("plugins/syntaxhighlighter/scripts/shBrushXml");//支持的语言
[/color]
3.定义要格式化的代码
<pre class='brush: java'>
@Override
public void init(FilterConfig cfg) throws ServletException {
super.init(cfg);
OnlineUserManager.init();
//this._dataInit();
}
</pre>
4.初始化
<script>$(document).ready(function(){
SyntaxHighlighter.config.clipboardSwf = './clipboard.swf';
SyntaxHighlighter.all();
});</script>