Jincheng bar front-end optimization essentials for DISCUZX _php Tutorial

Source: Internet
Author: User
Recently, the DX version of the Hong Sing basically determined, at least in the short term will not change greatly, therefore, I have the whole station of the Jincheng bar optimization, the operation of their own record down, one is a record, to prevent forgetting, and the second is to share their own experience with the online friends.

Front-End Optimization recommendation tool

Firefox browser +yslow+google pagespeed+firebug specific download address please own Baidu

First, DX Backstage and DIY optimization

1. Home DIY Avoid too many layers of nesting

Each of the DX frames produces very much, very much more code. My home page has been as simple as possible, the result of the light DOM has 1600 +, embarrassing me.

So, try not to use too many frames to nest

2. Avoid excessive user picture calls

The first member call is to use redirection, will slow down the speed of the page, Ucenter can be changed to pseudo-static, but at present there is a bug, no custom avatar member avatar is not displayed

3. Open gzip

In the background of the website or to the config.php file will be gzip open

4. The background map is reused as much as possible, reducing the number of background graphs

Each column of the background map as much as possible, so that you can reuse the picture, to find the balance between beauty and speed, this one, I actually also in the ongoing attempt, here is recommended to monitor the server access speed tracking, you can grasp the overall site by users when the speed of the situation.

5. Open and set up all kinds of optimizations and caches in the background

There's a lot of information on this, and I'm not wasting time here, (by Pia Fly ~ ~ ~)

Second, Code and space optimization

1. Using minify compression to combine JS

DX CSS Basic merge is very good, a page one to 2, but JS is a lot of. Open your template's common directory of Header.htm, see. Dense JS, and too many files will cause too much connection, slowing down.

Here we use minify to merge it into a compressed cache

First, download the Minify package, unzip, and upload the Min folder to the Web site root directory.

Then modify the 2 files:

Groupsconfig.php under the 1.min folder

/**
* Groups configuration for default Minify implementation
* @package minify
*/
/**
* Wish to use the Minify URI Builder app to suggest
* Changes. http://yourdomain/min/builder/
**/
Return Array (

Add the following code behind the code above

' Portal ' = = Array ('//static/js/common.js ', '//static/js/home_friendselector.js ', '//static/js/forum.js ', '// Static/js/portal.js '),

' Forum ' = Array ('//static/js/common.js ', '//static/js/home_friendselector.js ', '//static/js/forum.js '),

' Home ' + = Array ('//static/js/common.js ', '//static/js/home_friendselector.js ', '//static/js/home_cookie.js ', '// Static/js/home_common.js ', '//static/js/home_face.js ', '//static/js/home_manage.js '),

' Userapp ' = = Array ('//static/js/common.js ', '//static/js/home_friendselector.js ', '//static/js/forum.js ', '// Static/js/home_common.js '),

2. Modify the header.htm of the template

What the?? Where is this file???? I was defeated by you.

Modify the following to replace the first piece of code with the second paragraph


















{subtemplate Common/css_diy}

Replaced by

!--{if $_g[' basescript '] = = ' Forum ' | | $_g[' basescript '] = = ' G Roup '}-->

!--{elseif $_g[' basescript '] = = ' Home '}-->

!--{elseif $_g[' basescript '] = = ' Userap P '}-->

!--{elseif $_g[' basescript '] = = ' Portal '}-->

'!--{/if}-->
'!--{if $_g[' Basesc Ript ']! = ' Portal ' && $_get[' diy '] = = ' Yes ' && ($_g[mod] = = ' topic ' | | $_g[group][allowdiy]) &&!empty ($_g[' style '] [' Tplfi Le '])}-->

!--{/if}-->
!--{if $_get[diy] = = ' Yes ' && ($_g[mod] = = ' topic ' | | $_g[group][allowdiy]) &&!empty ($_g[' style '] [' tplfile '])}-->{subtemplate Common/css_diy}!--{/if}-->

Open the Jincheng bar home, point open source code, look at the head of the beginning JS is not a lot of AH

2. Modify the cache time of the image, Flash, CSS, JS

Set the cache for a long cache time for the above Dongdong. For example, 1 years, then after the first visit, users in this year will not download the background map, Flash,css,js. Of course, if you didn't change it.

method is to modify the Web site root directory. htaccess file

Add the following code



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

Iii. Summary

Well, for the time being optimization is these, through these optimizations, the YSlow score of Jincheng Bar rose from D to 80+ B, some pages scored 90+ a. Overall is still very effective.

If you need to forward this article, please also keep the Jincheng bar link, if you can help to make a friend chain, that would be very grateful ...

Attach some website ratings for YSlow in 07

Amazon D

AOL F

CNN F

ebay C

Google a

MSN F

MySpace D

Wikipedia C

Yahoo! A

YouTube D

Author: Jincheng Bar

Article Source: http://www.jincheng8.com.cn/thread-303-1-1.html

http://www.bkjia.com/PHPjc/322414.html www.bkjia.com true http://www.bkjia.com/PHPjc/322414.html techarticle recently, the DX version of Hong Sing basically determined, at least in the short term will not change greatly, therefore, I have the whole station of the Jincheng bar optimization, the operation of their own record down, one is a ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.