nngs 发表于 2004-6-25 21:27

一个可能的VBB的瘦身技巧

以前玩老版本的VBB时看到的. 也许对牧夫用的版本有些参考价值.

这个技巧提到的Font face在牧夫这里好象变成了Font Style.

下面是技巧的实现:

An easy way to save loads of bandwidth

Saving bandwidth is good for everyone, so here is a little tip to save absolutely buckets of it.

You may have noticed in your styles CP that there is an option to specify a 'class' for the various font sizes. This is what it's for  

Normally, if you use the default settings, every single piece of text on a vBulletin page will be surrounded by <font> tags, each of which contain this sort of information (view the source of this page and you'll see)


code:--------------------------------------------------------------------------------<font face="verdana, arial, helvetica, sans-serif" size="2">--------------------------------------------------------------------------------

You'll see that code repeated hundreds of times all over the pages. Wouldn't if be good if we could somehow take that formatting information and store it centrally in the HTML, then have all the <font> tags reference that single source?

Well you can.

Let's try it for the most common tag - <normalfont>.

Normally, <normalfont> is replaced with this sort of thing: <font face="verdana, arial, helvetica, sans-serif" size="2"> because your settings for <normalfont> look like this:



Let's get rid of all that superfluous information, and simply replace it with a CSS style definition:



<normalfont> will now be replaced with
code:--------------------------------------------------------------------------------<font class="nf">--------------------------------------------------------------------------------
This is much, much smaller than that long definition we had before, but how do we tell it what font and size we want it to use?

Look up at the top of your styles control panel, and you will see an area where you can edit the headinclude template. By default, your headinclude will look like this:
code:--------------------------------------------------------------------------------<meta http-equiv="MSThemeCompatible" content="Yes">
<style type="text/css">
BODY {
        SCROLLBAR-BASE-COLOR: {categorybackcolor};
        SCROLLBAR-ARROW-COLOR: {categoryfontcolor};
}
SELECT {
        FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
        FONT-SIZE: 11px;
        COLOR: #000000;
        BACKGROUND-COLOR: #CFCFCF
}
TEXTAREA, .bginput {
        FONT-SIZE: 12px;
        FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
        COLOR: #000000;
        BACKGROUND-COLOR: #CFCFCF
}
#all A:link, #all A:visited, #all A:active {
        COLOR: {linkcolor};
}
#all A:hover {
        COLOR: {hovercolor};
}
#cat A:link, #cat A:visited, #cat A:active {
        COLOR: {categoryfontcolor};
        TEXT-DECORATION: none;
}
#cat A:hover {
        COLOR: {categoryfontcolor};
        TEXT-DECORATION: underline;
}
#ltlink A:link, #ltlink A:visited, #ltlink A:active {
        COLOR: {linkcolor};
        TEXT-DECORATION: none;
}
#ltlink A:hover {
        COLOR: {hovercolor};
        TEXT-DECORATION: underline;
}
.thtcolor {
        COLOR: {tableheadtextcolor};
}
</style>

$headnewpm--------------------------------------------------------------------------------

Just before the closing </style> tag, we will now add our central definition for how <normalfont> will be formatted. Add this:
code:--------------------------------------------------------------------------------.nf {
        FONT-FAMILY: verdana, arial, helvetica, sans-serif;
        FONT-SIZE: 13px;
}--------------------------------------------------------------------------------

This CSS class definition will now be called for ALL the <normalfont> tags, so your resulting HTML pages will be much smaller. Repeat this for <smallfont> and <largefont> and you're laughing  

2EASY 发表于 2004-6-26 15:31

这个我已经注意到了,不过这大约只能减少2~4K的数据量,并且对显示速度上没有提高。

nngs 发表于 2004-6-27 09:00

网上看来的PHP加速

让你的论坛速度更快,PHP加速设置



PHP加速:Turck MMcache部署实现

昨日偶得朋友指点,告诉除了ZEND以外还有个PHP加速工具,于是搜索一番后在FreeBSD上安装设置成功。
加速软件名称:Turck MMcache
官方地址:http://turck-mmcache.sourceforge.net/
FreeBSD PORTS目录:/usr/ports/www/turck-mmcache

ports安装非常简单(如果要自己编译的话官方网站有指导说明),make完成后提示修改PHP.INI文件,增加以下信息:


zend_extension="/usr/local/lib/php/20020429/mmcache.so"
mmcache.shm_size="64"
mmcache.cache_dir="/tmp"
mmcache.enable="1"
mmcache.optimizer="1"
mmcache.check_mtime="1"
mmcache.debug="0"
mmcache.filter=""
mmcache.shm_max="0"
mmcache.shm_ttl="0"
mmcache.shm_prune_period="0"
mmcache.shm_only="0"
mmcache.compress="1"
mmcache.keys="shm_and_disk"
mmcache.sessions="shm_and_disk"
mmcache.content="shm_and_disk"

说明:
1、如果您的系统已经装了ZEND加速器,那么上述配置在PHP.INI中必须放在ZEND的前面,否则Apache不能启动;
2、mmcache.shm_size="64",这里的64是加速系统使用做CACHE的内存,默认是16M;根据您系统内存调整;
3、mmcache.cache_dir="/tmp",这个是加速器工作时候产生临时文件的目录,如果安装时候默认目录空间小了建议调整;不过就昨晚安装测试到现在,这个目录产生的文件也不多,如果访问量大的网站自己多监测几天看看。
4、上述配置功能的详细说明请参考:http://turck-mmcache.sourceforge.net/index_old.html#config

效果:现在系统同时有ZEND与MMcache加速器,PHP执行速度比原来是要快一些;ZEND优化已经开到最大;在itbbs.com系统上感觉最明显的就是BBS,以及软件下载后台程序输出HTML静态页面速度非常快,而仅有ZEND的时候有些停顿。

rjxie 发表于 2004-6-27 09:03

nngs好热心。

对咱们自己论坛的发展真支持,我感动...

nngs 发表于 2004-6-28 00:57

回复: nngs好热心。

最初由 rjxie 发表
对咱们自己论坛的发展真支持,我感动...

赶紧"汗"一把 (刚在侃天版学的)

我只是偶然看到的, 没费力就ZT过来了.

玄天凌龙 发表于 2004-6-28 08:47

我晕~
页: [1]
查看完整版本: 一个可能的VBB的瘦身技巧