Hello ppl,
yesterday I "borowed" some lines of code from phpbb, It's all about gzip compresing and the known bug of IE , Now I have on my root folder an htacces file with mod_gzip no to prevent gziping of my page because It's not comfortable browsing thru the pages and loading every time all the pictures 🙁
I saw that if I enable gzip compresion of phpBB the loading speed is increased and there are no problems about image caching .. every thing works ok.
Now I added some lines to 2 of my page, for testing and I saw impresive results ... normaly my index file has 52k (without pic's and flash) and with that part of code it has 10k .. this is an important change ... and a more visible change is on my site-map page from 73k uncompressed to 10k compressed 🙂
Now I want to ask you if I will need to add another part of code which phpbb is using on the bottom of the page, I will paste first the header code and after the bottom part :
$phpver = phpversion();
$useragent = (isset($_SERVER["HTTP_USER_AGENT"]) ) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT;
if ( $phpver >= '4.0.4pl1' && ( strstr($useragent,'compatible') || strstr($useragent,'Gecko') ) )
{
if ( extension_loaded('zlib') )
{
ob_start('ob_gzhandler');
}
}
else if ( $phpver > '4.0' )
{
if ( strstr($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') )
{
if ( extension_loaded('zlib') )
{
$do_gzip_compress = TRUE;
ob_start();
ob_implicit_flush(0);
header('Content-Encoding: gzip');
}
}
}
the bottom part
$gzip_contents = ob_get_contents();
ob_end_clean();
$gzip_size = strlen($gzip_contents);
$gzip_crc = crc32($gzip_contents);
$gzip_contents = gzcompress($gzip_contents, 9);
$gzip_contents = substr($gzip_contents, 0, strlen($gzip_contents) - 4);
echo "\x1f\x8b\x08\x00\x00\x00\x00\x00";
echo $gzip_contents;
echo pack('V', $gzip_crc);
echo pack('V', $gzip_size);
in my exemples I didn't add the last part of the code which I think it must pe inserted after the </html> tag , I'm wright ?
Without this part of code the page it seems to work ok ... it is compressed and displayed ok in opera 7.23 and ie 6 .. i will try it with Netscape 7 too
Can you tell me what's that part for ???
10x in advance
see ya