1
wizanda
Gzip code for XOOPS
  • 2007/10/25 17:26

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


if ($xoopsConfig['gzip_compression'] == 1){ob_start("zlib.output_handler");} else {ob_start();}

The recent addition of gzip too 2.0.17 isn't zlib and the php site, says zlib is better then (ob_gzhandler) and that you can't use both....
This can be placed in header.php so all content including iframes and external content is gzipped also and /include/common.php for XOOPS systems....

2
suico
Re: Gzip code for XOOPS
  • 2007/10/25 19:14

  • suico

  • Friend of XOOPS

  • Posts: 374

  • Since: 2003/7/24


Sorry I hadn't understood :( Can you explain as if I were a 12 years old boy beggining to understand coding?
Yogurt Social Network Service
Visit: http://www.marcellobrandao.eti.br/

3
Catzwolf
Re: Gzip code for XOOPS
  • 2007/10/25 19:17

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


Actually you will find this code in common.php, so this functionality is actually executed at start-up and this you don't need this anywhere else.

4
wizanda
Re: Gzip code for XOOPS
  • 2007/10/25 19:39

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Unless you also have lots of videos and iframes, which then if in the header also loads other people’s sites faster....

This is the code taken from the latest 2.0.17.1 common.php
if (empty($_SERVER['SERVER_NAME']) || substr(PHP_SAPI03) == 'cli') {
        
$xoopsConfig['gzip_compression'] = 0;
    }
    if ( 
$xoopsConfig['gzip_compression'] == && extension_loaded'zlib' ) && !ini_get'zlib.output_compression' ) ) {
        if ( @
ini_get'zlib.output_compression_level' ) < ) {
            
ini_set'zlib.output_compression_level');
        }
        
ob_start'ob_gzhandler' );
    }

As you see using ('ob_gzhandler') which if we check here is recommend, not as good as ('zlib.output')...
Quote:
Note: ob_gzhandler() requires the zlib extension.
Note: You cannot use both ob_gzhandler() and zlib.output_compression. Also note that using zlib.output_compression is preferred over ob_gzhandler().


If you notice in php.ini also there is a standard zlib.output on and not needing a level set, which is far easier and also works better……
Quote:
Sorry I hadn't understood


This compresses output of the files used….which you can test to see the smaller size of the site, to download to a persons browser.

Login

Who's Online

426 user(s) are online (322 user(s) are browsing Support Forums)


Members: 0


Guests: 426


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits