image
TEMPLATING
image  What is QuickSkin?
image  How fast is it?
DOCUMENTATION
image  Change Log
image  Properties
image  Methods
image  Control Structures
image  Extensions
image  Speed, Tip & Tricks
LICENSE
image  License Terms
DOWNLOAD QUICKSKIN
image  Download QuickSkin
image

QuickSkin: Tips

Search this site: 

Speed, Tips & Tricks

You can get additional speed by compressing your data prior to releasing it to the user's browser. There are many benefits of compressing your data. Essentially those are:

  • significant reductions in bandwidth up to 80% ... leads to lower overall costs
  • increased speed of display on the user's browser ... speeds gains average 70% to 80%

The benefits are significant and you have complete access to these techniques -- you do not have to modify PHP.INI.

There are two methods of achieving HTTP compression (or speed improvements). The first is by creating (or editing) your '.htaccess' file. This is the simplest method, since it does not involve having to create writable cache directories or anything else beyond these lines in the '.htaccess' file. This method works on all file types (but will not further compress images since they are already compressed formats).

.htaccess
php_flag zlib.output_compression on
php_value zlib.output_compression_level 6

The second technique is roughly about the same level of compression, but approximately 30% faster. The technique works only with PHP output, though. There is checking code included in the example to prevent any error messages.

<?php
 
if ( ini_get( 'zlib.output_compression' ) ) {
  if ( ini_get( 'zlib.output_compression_level' ) != 5) {
    ini_set( 'zlib.output_compression_level', '5' );
  }
  ob_start();
} else {
  if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'],"gzip")) {
    ob_start("ob_gzhandler");
  } else {
    ob_start();
  }
}
 
require_once "class.quickskin.php";
$page = new QuickSkin("substr.html");
 
$page->assign( 'HEADLINE',  'My Title' );
 
$page->output();
 
ob_end_flush();
 
?>