I have been trying to get this Zlib compression stuff working recently, as i have a 500kb web page that id like to be significantly reduced so loading times are reasonable! However, although i have followed tutorials on the internet, it doesnt seem to work. I mean, i use ob_start("ob_gxhandler") and all that, then try to display it all using while(@ob_end_flush());, but t doesnt display anything! here is the code...

	ob_start("ob_gzhandler");
	ob_implicit_flush(0);

?>

<center>
<h1>HTML Color Chart

<?PHP

if($color) {
	?>
		(Compared to <?PHP print $color ?>)</h1>
		<a href="html_colors12bit.php">Turn of Comparative Page</a><br /><br />
	<?PHP
}
else { print "</h1>"; }

?>

<table width="98%" cellpadding="0" cellspacing="0">

<?PHP

$cc[0] = "00";
$cc[1] = "11";
$cc[2] = "22";
$cc[3] = "33";
$cc[4] = "44";
$cc[5] = "55";
$cc[6] = "66";
$cc[7] = "77";
$cc[8] = "88";
$cc[9] = "99";
$cc[10] = "aa";
$cc[11] = "bb";
$cc[12] = "cc";
$cc[13] = "dd";
$cc[14] = "ee";
$cc[15] = "ff";

if($color) {
	$height = "10";
}
else { $height = "20"; }

for($q=0;$q<16;$q++) {

	?>
	<tr><td colspan="16">Now for the #<?PHP print $cc[$q] ?>----'s!</td></tr>
	<?PHP

	for($p=0;$p<16;$p++) {

		print "<tr>\n";

		for($o=0;$o<16;$o++) {

			?>

				<td bgcolor="#<?PHP print $cc[$q] ?><?PHP print $cc[$p] ?><?PHP print $cc[$o] ?>" width="6.125%" height="<?PHP print $height ?>" valign="top" onClick="alert('#<?PHP print $cc[$q] ?><?PHP print $cc[$p] ?><?PHP print $cc[$o] ?>')"></td>

			<?PHP

		}

		if($color) {
			?>
			<tr><td colspan="16" bgcolor="<?PHP print $color ?>" height=<?PHP print $height ?> onClick="alert('<?PHP print $color ?>')"></td></tr>
			<?PHP
		}

		print "</tr>\n";

	}

}

print "</table>";

$contents = ob_get_contents();
ob_end_clean();

if(ereg('gzip, deflate',$HTTP_ACCEPT_ENCODING)) {

ob_end_flush();
print "HERE";

} else {

echo $contents;
print "NO HERE";

}

It just ends up saying "HERE" (as you can see im using a top-down test to see where it goes!). But when i try again print $contents, loading times are not improved! Have i got somethign terribly wrong ?

Thanks for anything!

    Write a Reply...