开启pjblog3的代码高亮功能

  其实pjblog3带了codepress代码高亮功能,不知道为什么舜子没有用。。

  启用方法:
  打开common/ubbcode.asp.asp 找到:
[code=html]re.Pattern = "\[code\](.*?)\[\/code\]"[/code]
  在上面添加:
[code=html]
                re.Pattern = "\[code=([^\r]*?)\]([^\r]*?)\[\/code]"
                Set strMatchs = re.Execute(strContent)
                For Each strMatch in strMatchs
                    rndID="codeid_"&Int(100000 * Rnd)
                    tmpStr1 = strMatch.SubMatches(0)
                    tmpStr2 = replace(strMatch.SubMatches(1),"<br/>",CHR(10))
                    strContent=replace(strContent,strMatch.Value,"<textarea id="""&rndID&""" class=""codepress "&LCase(tmpStr1)&""" rows=""50"" style=""width:99%"" wrap=""off"">"&tmpStr2&"</textarea>",1,-1,0)
                   Next[/code]

  打开footer.asp和Template/static.htm
  在</body>上添加
[code=html]<script type="text/javascript" src="common/codepress/codepress.js"></script>[/code]

使用方法
【code=语言】代码【/code】
例:【code=php】<?php echo("Hello World!");?>【/code】

  方括号内的"php"可替换为以下任意类型(支持的语法):
  csharp
  css
  generic
  html
  java
  javascript
  perl
  ruby
  php
  text
  sql
  vbscript


评论: 1 | 引用: 0 | 查看次数: 1997
df
回复回复df [2008-11-13 11:13:38 | del | 取消审核]
pj的codepress代码高亮功能用在后台的主题编辑中

情留メ蚊子 于 2008-11-13 12:44 AM 回复
噢原来如此

发表评论
昵 称:
密 码:    游客发言不需要密码.
邮 箱:    支持Gravatar头像
网 址:
验证码:    点击输入框
内 容:
您一共可以输入1000个字
选 项:
不想保留信息请删除cookie
发表评论后您发表的内容自动复制到了剪贴板
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 开启 | [img]标签 关闭