Skip to content

Asset Gzip cache serve

World Wide Web Server edited this page Jul 4, 2012 · 41 revisions

[b]This is a asset(js, css, jpg, png etc...) serving gzip compressing caching class.[/b]

[b][size=4]File:gz_asset_helper.zip[/size][/b]

[b]The only area you need to change is the settings area at the beginning of the class.[/b]

[code] var $debug = FALSE; [/code] [i] set for true to output all the settings instead of the asset[/i] [i]Hence the name $debug[/i] [code]

var $headers = array();
var $target_file = array();
var $sysValues = array();
var $set =  array(
    'VERSION' => '0.75',
    'path2assets' => APPPATH, 
    'asset_exp' => 25920000,
    'uri' => '',
    );
var $asset_types = array(
    "htm"  => "text/html",
    "html" => "text/html",
    "js"   => "text/javascript",
    "css"  => "text/css",
    "xml"  => "text/xml",
    "gif"  => "image/gif",
    "jpg"  => "image/jpeg",
    "jpeg" => "image/jpeg",
    "png"  => "image/png",
    "txt"  => "text/plain"        
    );    
var $assets_folder = array(
    'js'=>'assets/js/',
    'css'=>'assets/css/',
    'gif'=>'assets/images/',
    'jpg'=>'assets/images/',
    'jpeg'=>'assets/images/',
    'png'=>'assets/images/'
     );
// after document root e.g.
// IF:   home/www/directory/my_application/cache_folder
// THEN:          directory/my_application/cache_folder 
// NOTE: home/www will be entered in by _gzip_available()
var $cache_folder = array(
    'js'=>'sysFunc/cache/',
    'css'=>'sysFunc/cache/',
    'gif'=>'sysFunc/cache/',
    'jpg'=>'sysFunc/cache/',
    'jpeg'=>'sysFunc/cache/',
    'png'=>'sysFunc/cache/',
    'swf'=>'sysFunc/cache/'    
);

[/code]

Clone this wiki locally