vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   gzip your CSS (https://vborg.vbsupport.ru/showthread.php?t=110599)

hidjra 03-16-2006 10:00 PM

gzip your CSS
 
Step 1
Create a new file, call it 'gzip-css.php' copy the following snippet and upload to the 'vbulletin_css' folder:

PHP Code:

<?php
ob_start
('ob_gzhandler');
header('Content-type: text/css; charset: UTF-8');
header('Cache-Control: must-revalidate');
header('Expires: Thu, 3 Jan 2007 23:53:18 GMT');
?>

Step 2
create a .htaccess file, put this in the same directory as above, put in the following snippet:

PHP Code:

php_value auto_prepend_file gzip-css.php 

Step 3
Open the adminfunctions_template.php file located in the 'includes' directory. Look for the following:

PHP Code:

$cssfilename 'clientscript/vbulletin_css/style-' substr(md5(microtime()), 88) . '-' str_pad($styleid5'0'STR_PAD_LEFT) . '.php'

change it to

PHP Code:

$cssfilename 'clientscript/vbulletin_css/style-' substr(md5(microtime()), 88) . '-' str_pad($styleid5'0'STR_PAD_LEFT) . '.css'

Now login to you vb control panel, re-generate the css file and your done. Enjoy ;)

daklay 03-16-2006 10:56 PM

FIRST POST

Awesomse idea man :banana:

Andreas 03-16-2006 11:04 PM

IMHO it would be easeir to just use mod_gzip ?

yinyang 03-17-2006 01:30 AM

what's this for?

aladinliverpool 03-17-2006 02:34 AM

its for gzip'ing your CSS!

like gzip'ing up your coat when its chilly. ;)

Zia 03-17-2006 04:44 AM

umm gzip css ?
confused... it should help to load the page faster ?

mod_gzip ..its possible to use it in shared server?

Zachery 03-17-2006 03:50 PM

Hmm, I wouldn;'st suggest that, at least if I understand some things. I believe that IE has some issues cacheing gziped pages, and the CSS file should only be requested a few times before cached, thus why we have it as a file.

Snake 03-17-2006 04:56 PM

Thanks!

Zia 03-17-2006 05:05 PM

Quote:

Originally Posted by Zachery
and the CSS file should only be requested a few times before cached, thus why we have it as a file.

that means this edit will make the css "save as files" ???!!

this option allready in vb's acp.

goyo 03-17-2006 05:52 PM

Quote:

Originally Posted by Zia
that means this edit will make the css "save as files" ???!!

this option allready in vb's acp.

No... this means your server zipping up your .ccs file before sending to your browser. Thus less bandwidth usage... although I don't see the real point of this hack as .css files downloaded only once or twice than stored for weeks/months (if no changes in .css sizes) by all modern browsers.

Zia 03-19-2006 06:48 AM

hmm then no need to use this att all....

HeRCuL70 03-20-2006 11:04 PM

is it working at winodws servers?

briansol 04-24-2006 06:16 AM

is step 3 bakwards?

I had .css in there, not .php

Hemanth 04-24-2006 06:45 AM

Good work..

But is there any increase in performance?

Zachery 04-24-2006 07:30 AM

Increase preformace would be removing gzip, decreasing preformance would be adding it back.

El-Gazaly 05-07-2006 02:09 AM

This code
$cssfilename = 'clientscript/vbulletin_css/style-' . substr(md5(microtime()), 8, 8) . '-' . str_pad($styleid, 5, '0', STR_PAD_LEFT) . '.css';
is in file alreadey
and iam not editing it before

Code Monkey 05-07-2006 03:43 AM

This is pointless since browsers cache all css and javascript when they are seperate files. It IS why you should always have them in a seperate file. Most webservers are running mod_deflate or equivilents that compress text in a way that browser can interpret. Browsers check and compare the time and date of last update for css and javascript files before downloading. So unless you have changed the css file, they will not be downloading the css in the first place.

But, do as you please.

ShiningArcanine 06-14-2006 08:03 PM

Personally, I think gzipping css files will not add as much bandwidth savings as gzipping .php files would but more bandwidth savings and faster initial page loads make doing something like this worth it.


All times are GMT. The time now is 05:49 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01162 seconds
  • Memory Usage 1,752KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (18)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete