ezosC v2.1 is a turnkey e-commerce online store business solution based in osCommerce 2.2 RC 2a with a full supported IT and tech support staff.  ezosC v2.1  can be customized for any business’ needs with its open source. We have added additional functionality to this store by adding modules for every business to profit from. You need to have the edge over your competition with modules that will set you apart from the rest.

After years of experience developing and repairing shopping carts, we have developed the functionality of the carts that we have made for the various clients, in one great e-commerce solution. From turnkey apparel e-commerce stores and automotive online stores, to reservation systems e-commerce and book online stores, we have developed the ultimate online shopping experience for your customers. Read more

Click here for more information

 
Call Now 1.800.961.7427

 

Complete eCommerce Solution
Based in osCommerce

Help - Search - Members - Calendar
Full Version: Compressing Pages
osCommerce Community Support Forums > osCommerce Online Merchant v2.x > Tips and Tricks
spooks
This may be placed elswhere but I could'nt find it in this version.

This dead simple mod compresses pages at the server as they delivered to the client browser (if it supports compression) using gzip.

It can give upto 80% reduction in size, so speed download, there is no extra load to server.

There is a option in admin, so if you have that 'on' don`t apply this to the client side.

This can be done for any php document.

In application_top.php both on client side & admin, near the top, after <?php

add:

ob_start("ob_gzhandler");

Thats it, you should notice a speed increase on loading admin pages immediatly, client pages will be faster, especially if using dial-up.

I have`nt found any downside to date.

NimaP
which browsers don't support gzip?
spooks
QUOTE (NimaP @ May 28 2008, 11:38 PM) *
which browsers don't support gzip?


IE 3 & older, Opera 4 & older Netscape 3 & older, and certain versions of firefox (not sure which)
Java Roasters
I already have this in my version of MS2.2

CODE
// if gzip_compression is enabled, start to buffer the output
if ((GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) &&
    (PHP_VERSION >= '4')) {
    if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {
        if (PHP_VERSION >= '4.0.4') {
            ob_start('ob_gzhandler');
        } else {
            include (DIR_WS_FUNCTIONS . 'gzip_compression.php');
            ob_start();
            ob_implicit_flush();
        }
    } else {
        ini_set('zlib.output_compression_level', GZIP_LEVEL);
    }
}

spooks
QUOTE (Java Roasters @ May 29 2008, 05:50 PM) *
I already have this in my version of MS2.2

CODE
// if gzip_compression is enabled, start to buffer the output
if ((GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) &&
    (PHP_VERSION >= '4')) {
    if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {
        if (PHP_VERSION >= '4.0.4') {
            ob_start('ob_gzhandler');
        } else {
            include (DIR_WS_FUNCTIONS . 'gzip_compression.php');
            ob_start();
            ob_implicit_flush();
        }
    } else {
        ini_set('zlib.output_compression_level', GZIP_LEVEL);
    }
}



Hi, I did mention the option in admin, which controls this bit of code, the point of this tip is to make people aware of this very handy option & how to apply it in admin as well, or any other php pages.

Try it on your admin & see just how much quicker they load.

wink.gif
NimaP
wow..i just applied this to my admin.

what a difference in speed! great tip!
Coopco
Hey Spooks, thanks. Have seen that option for yonks but never touched it till now. I think load times have halved and I am using the default value of 5..
WoodsWalker
This is way cool, Sam. Thanks! cool.gif

~Wendy
joebloggs
Fantastic tip m8 i never knew what that was for !!!!!!!!!!!! laugh.gif laugh.gif laugh.gif laugh.gif
dreakies
Thanx! Great tip!
cmakynen
Wow - that works great - thanks!
Just curious - if an old non-supporting browser opens a page with this code in it. what happens? It croaks, or it just passes over it?
dark_tyrant
What does the unsupported browsers show when using this?
spooks
QUOTE (dark_tyrant @ Jun 10 2008, 08:02 AM) *
What does the unsupported browsers show when using this?


Thay wont show any differance, the server will detect the browser does'nt support compression, so will serve uncompressed pages, so the only differance will be the load speed.
WoodsWalker
Even MORE cool! cool.gif cool.gif
dark_tyrant
QUOTE (spooks @ Jun 10 2008, 02:59 PM) *
Thay wont show any differance, the server will detect the browser does'nt support compression, so will serve uncompressed pages, so the only differance will be the load speed.


Interesting. Thanks for the information.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.
Powered by osCommerce.com | Oscommerce Forum