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] [quote] [b][size=4]File:gz_asset_helper.zip[/size][/b] [/quote] [em]The only area you need to change is the settings area at the beginning of the class.[/em]

[code] var $debug = FALSE; [/code] [em] set for true to output all the settings instead of the asset[/em] [i]Hence the name $debug[/i] [code] var $headers = array(); var $target_file = array(); var $sysValues = array(); [/code] [em] set some arrays for storing values[/em] [code] var $set = array( 'VERSION' => '0.75', 'path2assets' => APPPATH, 'asset_exp' => 25920000, 'uri' => '', ); [/code] [em]path2assests: is the path to your assets folders [/em] [em]asset_exp: is the expiry date of the cached asset (in milliseconds) [/em] [code] 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"
); [/code] [em]asset_types: asset content [url=http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html]types [/url][/em] [code]
var $assets_folder = array( 'js'=>'assets/js/', 'css'=>'assets/css/', 'gif'=>'assets/images/', 'jpg'=>'assets/images/', 'jpeg'=>'assets/images/', 'png'=>'assets/images/' ); [/code] [em]assets_folder: folders where assets can be found.[/em] [pre]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()[/pre] [code] 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