Code高亮设置

林继 PHP 技术 6,033 共写了383个字 (2006-09-29 19:30:23) 没有评论 打印 扫描二维码 百度已收录

From:http://mesak.wablog.info/blog/read.php?235

首先是上官方下载原始码,接着打开 inc/ubb.php

$regubb_search & $regubb_replace 未端,各加上一个 array

  1. "/\s*\[codes=(.+?)\][\n\r]*(.+?)[\n\r]*\[\/codes\]\s*/ie"
  2. "makeHighlightcode('\\1', '\\2')"

接着插入一个 function

  1. function makeHighlightcode ($type, $str) {    
  2.   $str=str_replace("<br/>", "n" , stripslashes($str));    
  3.   return "<textarea name="code" class="{$type}" rows="15" cols="100">{$str}</textarea>";    
  4. }

很容易,大功造成~~接下来只要想办法加入 CSS 跟 Javascript 即可,当然路径要放对~

  1. <link type="text/css" rel="stylesheet" href="images/css/SyntaxHighlighter.css"></link>     
  2.  
  3. <script class="javascript" src="images/hl/shCore.js"></script>     
  4. <script class="javascript" src="images/hl/shBrushCSharp.js"></script>     
  5. <script class="javascript" src="images/hl/shBrushPhp.js"></script>     
  6. <script class="javascript" src="images/hl/shBrushJScript.js"></script>     
  7. <script class="javascript" src="images/hl/shBrushJava.js"></script>     
  8. <script class="javascript" src="images/hl/shBrushVb.js"></script>     
  9. <script class="javascript" src="images/hl/shBrushSql.js"></script>     
  10. <script class="javascript" src="images/hl/shBrushXml.js"></script>     
  11. <script class="javascript" src="images/hl/shBrushDelphi.js"></script>     
  12. <script class="javascript" src="images/hl/shBrushPython.js"></script>     
  13. <script class="javascript" src="images/hl/shBrushRuby.js"></script>     
  14. <script class="javascript" src="images/hl/shBrushCss.js"></script>     
  15. <script class="javascript" src="images/hl/shBrushCpp.js"></script>     
  16. <script class="javascript">dp.SyntaxHighlighter.HighlightAll('code');</script>    
  17. <link type="text/css" rel="stylesheet" href="images/css/SyntaxHighlighter.css"></link>  
  18.  
  19. <script class="javascript" src="images/hl/shCore.js"></script>  
  20. <script class="javascript" src="images/hl/shBrushCSharp.js"></script>  
  21. <script class="javascript" src="images/hl/shBrushPhp.js"></script>  
  22. <script class="javascript" src="images/hl/shBrushJScript.js"></script>  
  23. <script class="javascript" src="images/hl/shBrushJava.js"></script>  
  24. <script class="javascript" src="images/hl/shBrushVb.js"></script>  
  25. <script class="javascript" src="images/hl/shBrushSql.js"></script>  
  26. <script class="javascript" src="images/hl/shBrushXml.js"></script>  
  27. <script class="javascript" src="images/hl/shBrushDelphi.js"></script>  
  28. <script class="javascript" src="images/hl/shBrushPython.js"></script>  
  29. <script class="javascript" src="images/hl/shBrushRuby.js"></script>  
  30. <script class="javascript" src="images/hl/shBrushCss.js"></script>  
  31. <script class="javascript" src="images/hl/shBrushCpp.js"></script>  
  32. <script class="javascript">dp.SyntaxHighlighter.HighlightAll('code');</script>

由于可能不需要用到这么多的语法高亮,剩下的可以自由删除~

可以在底部模组内新增 javascript ,在模板文件的前面加入 CSS

缺点:

只要 Bob 一更新 Boblog,步骤就要重新执行一次…

Code内有 textarea 的时候将会非常麻烦

如果觉得我的文章对您有用,请随意赞赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注

< >