Wiki source for Mod008fCompression


Show raw source

==== Wikka Mod 008 ====
Type: Feature Addition
----
===Credit:===
**[[http://www.wikini.net/wakka.php?wiki=PatrickPaul | PatrickPaul]]**
http://www.wikini.net/
----

Implemented gzip encoding.

File modified: /wakka.php


%%(php)

// create wakka object
$wakka = new Wakka($wakkaConfig);

function compress_output($output)
{
return gzencode($output);
}

// Check if the browser supports gzip encoding, HTTP_ACCEPT_ENCODING
if (strstr ($HTTP_SERVER_VARS['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') )
{
// Start output buffering, and register compress_output() (see
// below)
ob_start ("compress_output");

// Tell the browser the content is compressed with gzip
header ("Content-Encoding: gzip");
}

%%

----

Why not use simple
ob_start("ob_gzhandler");
instead?

-- RomanIvanov,
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki