Neyond at August 25th. 2008, 11:11am in Web development
在wordpress中显示搜索结果的条数,将如下代码放到search.php页面,即可看到效果.
1: <?php
2: $search_count = 0;
3:
4: $search = new WP_Query("s=$s & showposts=-1");
5: if($search->have_posts()) : while($search->have_posts()) : $search->the_post();
6: $search_count++;
7: endwhile; endif;
8:
9: echo $search_count;
10: ?>
同样也可以下载相关插件:http://www.mtaylor.co.uk/wordp.....count.phps
Neyond at August 21st. 2008, 2:03am in I like the
每当如此深夜,我又想起了他.
一如多年前的晚上,仿佛一切就发生在昨天!
看着哭泣的面孔,活着的人们还得继续,或许我们从不曾改变什么,或许什么都不曾改变我们,一如往日清晰,仿佛一切都已不在.
可谁又能明白…
我的下一站在哪儿…
Neyond at August 19th. 2008, 6:21pm in Digests read
看过之后蛮多感触的,就拷贝过来.行业啊,行业…
前段时间一个朋友对我说到:“老艺不知你有没有看到在篇文章?有点意思,谈谈你的感想,或者你比我感悟更深?!”他说:“今天收到一封求职信,又是一个热血青年写来的。他说他发现了文学的另一个用武之地,艺术的又一片激情天空。热血在他的血管里沸腾,创造欲使他无法按纳,一头狮子在他的心头咆哮:我要做创意!一头公牛在他的肺里大喊:我要做广告!完了,又一个倒楣蛋死定了。我把求职信丢进废纸瘘,没什么好感, Read More …
Neyond at August 19th. 2008, 6:10pm in Cool site
Neyond at August 18th. 2008, 10:56am in Web development
做这个THEME时用到的prototype.js有124KB,相当的大,经过压缩后只有50KB,效果还是相当明显.
下面我们介绍这个工具:ESC(ECMAScript cruncher)来帮我们完成这个工作,不过这个工具只能在Windows下使用.到http://www.saltstorm.net/depo/.....wbm?pod=js下载ESC.zip,解压后看看它的帮助文档.很简单.
压缩级别分为5种,从0到4
- Level 0 : No compression
- Level 1 : Comment removal
- Level 2 : Whitespace removal
- Level 3 : Newline removal
- Level 4 : Variable substitution
在WINDOWS命令行下执行
- X:\cscript ESC.wsf -ow crunched.js original1.js original2.js original3.js
- X:\cscript ESC.wsf -l 1 -oa crunched.js C:\script-directory
- X:\cscript ESC.wsf -l 0 -$ -ow STDOUT original1.js original2.js
- X:\cscript ESC.wsf -l 4 -ow crunched.js original.js
- X:\cscript ESC.wsf -l 4 -ow crunched.js original.js > verbose.txt
———————————————————–
Usage :
ESC.wsf -l [0-4] -ow output.js foo.js bar.js C:\scripts\baz
———————————————————–
-a [-about] : Description page
-c [-copyright] : Copyright/license notice
-e [-example] : Examples of usage
-h [-help] : This help-screen
———————————————————–
-l [-level] [01(2)34] : [optional] Set crunch-level (4 sets -$ on)
-s [-silent] : [optional] Run silent, nada stdout
-v [-verbose] : [optional] Run in verbose mode
-$ : [optional] Activate variable-substitution engine
———————————————————–
-oa <filename> : Target filename for appending
-ow <filename> : Target filename for writing
-ow STDOUT : Write stream to STDOUT
———————————————————–
<input-file(s)> : [required]
file(s) and/or directories containing scripts to crunch…
(If filenames contains spaces, they must be quoted)
需要注意的是,js压缩级别4会把变量名修改,如果你的js中用到了全局变量或者类的话,就不能使用该压缩级别了,否则其它使用你的js的文件可能会无法正常运行.
还有几个在线的压缩工具,也相当不错.