晋城吧对DiscuzX进行的前端优化要点
最近,康盛的DX版本基本确定,至少短期内不会大变了,因此,我对晋城吧的整站进行了前端优化,把自己 所做的操作记录下来,一是有个记录,防止忘掉,二是和网上的朋友们共享下自己的心得。
前端优化 推荐工具
火狐浏览器+Yslow+google pagespeed+Firebug 具体下载地址 请自行百度
一、DX后台 及DIY的优化
1.首页DIY避免过多层的嵌套
DX的每一个框架都会产生非常多非常多非常多的 代码。我的首页已经尽可能简单了,结果光 DOM 有1600+,囧死我了。
所以,尽可能不要用过多的框架嵌套
2.避免过多的用户头像调用
首页的会员调用是使用重定向的,会减慢网页的速度,UCenter倒是能改为伪静态,但是目前是有BUG的,没有自定义头像 的会员头像是无法显示的
3.打开Gzip
在网站后台 或者到config.php文件 将Gzip打开
4.背景图尽可能重复利用,减少背景图的数量
各个栏目的背景图尽可能一样,这样可以重复利用图片,要找到美观和速度之间的平衡,这一条,我其实也还在不断的尝试 中,这里推荐监控宝的服务器访 问速度跟踪,可以全局掌握自己网站被用户访问时的速度状况。
5.打开并设置好后台的各种优化和缓存
关于这方面的资料很多,我就不在这里浪费时间了,(被pia飞~~~)
二、代码 及空间优化
1.利用minify压缩合并js
DX的CSS 基本合并的很好,一个页面一到2个,但是JS就很多了。打开你的模板的common目录的header.htm,看到么。密密麻麻的js ,而过 多的文件会造成连接过多,减慢速度。
这里我们利用minify将其合并 压缩 缓存
首先,下载minify的压缩包,解压,将min文件夹上传到网站根目录。
然后修改2个文件:
1.min 文件夹下的groupsConfig.php
/** |
在上边的代码后边加上如下的代码
'portal' => array('//static/js/common.js', '//static/js/home_friendselector.js', '//static/js/forum.js', '//static/js/portal.js'), |
什么??这个文件在哪里????我被你们打败了。。
修改如下 ,将第一段代码 替换为第二段
{subtemplate common/css_diy} |
替换为
{subtemplate common/css_diy} |
打开晋城吧首页,点开源代码 ,看看 开头 的 head 里的 js 是不是少了很多啊
2.修改图片、flash、css、js的缓存时间
为上述东东设置缓存一个长长的缓存时间。比如1年,那么在第一次访问后,用户在这一年中都不用下载背景图,flash,css,js 。当然前提是你没有修改
方法 是修改网站根目录.htaccess文件
加入如下代码
Header set Cache-Control "max-age=43200″ #cache css, javascript and text files for one week Header set Cache-Control "max-age=604800″ #cache flash and images for one month Header set Cache-Control "max-age=2592000″ #disable cache for script files Header unset Cache-Control |
三、总结
恩,暂时的优化就是这些,通过这些优化,晋城吧 的yslow评分从50 D 上升到80+ B ,有些页面的评分为90+ A.总体还是很有效果的。
如果你需要转发此文,还请保留晋城吧链 接,如果能帮忙做个友链,那就太感谢了。。。
附上一些网站在07年Yslow的评分
Amazon D
AOL F
CNN F
eBay C
Google A
MSN F
MySpace D
Wikipedia C
Yahoo! A
YouTube D
作者:晋城吧
文章来源:http://www.jincheng8.com.cn/thread-303-1-1.html

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The meaning and difference of PHP version NTS PHP is a popular server-side scripting language that is widely used in the field of web development. There are two main versions of PHP: ThreadSafe(TS) and Non-ThreadSafe(NTS). On the official website of PHP, we can see two different PHP download versions, namely PHPNTS and PHPTS. So, what does PHP version NTS mean? What is the difference between it and the TS version? Next,

Regarding Llama3, new test results have been released - the large model evaluation community LMSYS released a large model ranking list. Llama3 ranked fifth, and tied for first place with GPT-4 in the English category. The picture is different from other benchmarks. This list is based on one-on-one battles between models, and the evaluators from all over the network make their own propositions and scores. In the end, Llama3 ranked fifth on the list, followed by three different versions of GPT-4 and Claude3 Super Cup Opus. In the English single list, Llama3 overtook Claude and tied with GPT-4. Regarding this result, Meta’s chief scientist LeCun was very happy and forwarded the tweet and

In front-end development interviews, common questions cover a wide range of topics, including HTML/CSS basics, JavaScript basics, frameworks and libraries, project experience, algorithms and data structures, performance optimization, cross-domain requests, front-end engineering, design patterns, and new technologies and trends. . Interviewer questions are designed to assess the candidate's technical skills, project experience, and understanding of industry trends. Therefore, candidates should be fully prepared in these areas to demonstrate their abilities and expertise.

Friends in the workplace must be familiar with PPT production! Whether it is year-end summaries or commercial bidding, etc., PPT is often used to express it. However, for those who are new to PPT production, they don’t know much about the PPT versions. Let’s take stock of a few PPTs. Version. 1. PPT2003PowerPower2003 is an office software. It has a simple interface, fast operation, easy to use, and does not require high computer configuration. It has basic functions such as word processing, image processing, graphics editing, animation operation, and multimedia insertion. 2. PPT2007PowerPoint2007 inherits the advantages of the previous version and has greatly improved its functions. Get used to PowerPoint

With the popularity of Douyin, more and more companies and individuals have begun to use Douyin for marketing. As an important tool for Douyin marketing, the Douyin matrix management system has also received widespread attention. So, which version of Douyin matrix management system is recommended? This article will answer this question for you and introduce how to play Douyin matrix marketing. 1. Which version of Douyin matrix management system is recommended? There are many versions of the Douyin matrix management system. The following versions are currently popular on the market: Douyin’s official version of the matrix management system is specially designed for companies with certain operating experience and budget, and can realize multi-account management, data Analysis and material library functions. This system provides an efficient way to manage Douyin accounts and helps companies better understand their operational data to better

1. Open the Douyin app and click [Me] in the lower right corner to enter the personal page. 2. Click the [Three Stripes] icon in the upper right corner and select the [Settings] option in the pop-up menu bar. 3. In the settings page, scroll to the bottom to view the current version number information of Douyin.

There are currently 4 versions of World of Warcraft. The national server has been closed for more than a year. It is estimated that many players do not know where each version has developed. Let's sort out the current status of each version. 1. At the end of the official server version 10.0, before the closure of the national server, version 10.0 has just started. It is currently in version 10.26. There will be version 10.27 later, and the Age of Dragon expansion pack will be over. Although version 10.0 has received good reviews in foreign servers and has restored some popularity for Blizzard, the core of the game in version 10.0 has not changed at all. It is still mainly about big secrets and raids, and the number of PVP players is very small. With the continuous updates of the official server version, players’ gaming tendencies have also changed from PVE and PVP to collecting.

Many users are considering upgrading to the Windows 10 operating system. As Microsoft announced that it will no longer provide security updates and technical support for Windows 7. However, a considerable number of users still choose to stick to the Win7 system and look for office software suitable for this system. To help users improve office efficiency, this article will introduce several Office versions that are most suitable for Win7 systems. 1.Office2010: the perfect combination of stability and compatibility 2.Office2013: interface optimization and practical function upgrades 3.Office2016: new features of cross-platform collaboration and cloud storage 4.OfficeOnline: lightweight, free, online office anytime and anywhere 5 .WPSOffice:
