Code highlight plugnis Demo
需要注意language name:php sql css javascript html4strict 名字好像要和 geshi目录下的文件名前缀符合。非常不错,如果在post的menu上多一个
的按钮就好了,研究一下怎么改那个code的按钮:
找到解决方法了:
打开wp-includes/js/quicktags.js,搜索 code 大约118-120行左右 :
edButtons[edButtons.length] =
new edButton('ed_code'
,'code'
,''
,''
,'c'
);
把code改成 pre lang="" ,然后上传 ,ctrl+F5 刷新,效果就出来了。
实例效果如下:
php
* @version v 3.0
* @access public
* @copyright 1615.cn
*/
session_start ();
require_once 'inc/config.inc.php';
$strSomethingNull = "对不起,用户名和密码必须填写";
$messageLoginOk = "您已经登录1615呼叫中心系统";
$messageLogigOut = "您已经退出本系统";
$strPageTitle = "用户登录";
if ($_POST ['action'] == "login") {
if ($_POST ['username'] && $_POST ['password']) {
$strUsername = hFilter ( $_POST ['username'] );
$passwd = hFilter ( $_POST ['password'] );
$User = new User ( );
$User->checkUser ( $strUsername, $passwd );
$_SESSION ['user'] = $User->arrUser;
showMsgHtml ($messageLoginOk, 3,"index.php" );
} else {
showMsgHtml ( "$strSomethingNull", 3, "index.php" );
}
} elseif ($_REQUEST ['action'] == "logout") {
session_unset ();
session_destroy ();
showMsgHtml ( $messageLogigOut, 3, 'login.php' );
}
else {
$Smarty->assign ( 'pageTitle', $strPageTitle );
$Smarty->display ( TEMPLATES . '/login.tpl' );
}
?>
SQL
UPDATE `product` Set `PurchasePrice` = (`PurchasePrice`*`Storage`+12*21)/(`Storage`+12), `Storage` = `Storage` + 12 WHERE Productid = 4;
CSS
/* Base setup
---------------------------------------------------------------------------*/
* {
margin: 0;
font-family: Tahoma, Microsoft Sans Serif, Verdana;
font-size: 12px;
}
p {
font-size: 14px;
}
h1 {
font-size: 28px;
}
img {
border: 0px;
}
a:link, a:visited {
text-decoration: none;
}
a:hover, a:active {
text-decoration: none;
}
javascript
function myResize(){
var windowHeight = $(window).height() - 48 - 30;
var documentHeight = $(document).height() - 48 - 30 - 3;
if (windowHeight > documentHeight) {
var finalHeight = windowHeight;
}
else {
var finalHeight = documentHeight;
}
//处理菜单条宽度
$("#mainNav").css("height", finalHeight);
//处理主内容的宽度
var contentWidth = document.body.clientWidth - 210;
$("#content").css("width", contentWidth);
}
HTML

我按照这个方法使用不成功。
你说的是 修改code按钮还是code highlight啊
我到WP网站下载一个highlight-source-pro.1.3的插件,安装好了,同时也设置了code按钮,按钮没有问题,但是就显示出来有问题。
还是试试看这个吧,国人写的
http://www.deanlee.cn/wordpress/code_highlighter_plugin_for_wordpress/
行号你可以在pre里面加一个class=8试试。
好像不行 你的可以吗?
我看geshi.css里面也没有这个class=8的说法,你从哪里找出来的资料啊,我也来研究一下。
我是按照highlight-source-pro.1.3中写的,不过后来我安装了一个WP-Syntax的,这个就比较简单了,直接在pre里面输入line=1就将行号打开了。你试试。
没有大的影响,其实有行号对别人copy代码并没有好处,因为copy出去有行号不能直接用,要把行号去掉才可以用的。