That's great, but do you think it would be helpful that when you do figure something out, you tell other people how you did it?
Thanks.
Good idea. Sorry about not doing that. Here's what I had to do.
1) Since my server does not allow mod_deflate or mod_gzip, I had to compress the jsquery script with PHP. I created a file and placed it in my root directory called gzip.php. Within the file is this code:
<?php
ob_start ("ob_gzhandler");
if( isset($_REQUEST['file']) ){
$file = $_REQUEST['file'];
if( goodfile($file) ){
$ext = end(explode(".", $file));
switch($ext){
case 'css':$contenttype = 'css';break;
case 'js':$contenttype = 'javascript';break;
default:die();break;
}
header('Content-type: text/'.$contenttype.'; charset: UTF-8');
header ("cache-control: must-revalidate");
$offset = 60 * 60;
$expire = "expires: " . gmdate ("D, d M Y H:i:s", time() + $offset) . " GMT";
header ($expire);
$data = file_get_contents($file);
$data = compress($data);
echo $data;
}
}
exit;
function goodfile($file){
$invalidChars=array("\\","\"",";",">","<",".php");
$file=str_replace($invalidChars,"",$file);
if( file_exists($file) ) return true;
return false;
}
function compress($buffer) {
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer);
return $buffer;
}
?>
I then added this to my .htaccess file:
RewriteEngine on
RewriteRule ^(.*).js$ pathtoyourwebsite/gzip.php?file=$1.js [L]
Now all my scripts are compressed. I still have not figured out how to combine the external scripts, but I am pleased with them all being compressed. Saves a lot of space. Hope this is helpful!
Thomas