-
Compressing your pages, the easy way :)
Hi guys, I made this PHP script, and you can use it to compress your CSS stylesheets, javascript files, text files, html files, and if you modify it, you can compress almost every text based file you want.
Here it is:
<?php
// made by João Jerónimo from http://joaojeronimo.freehostia.com
$file = $_GET['file'];
$ext = end(explode(".", $file));
switch($ext) {
case 'html':$type = 'text/html';break;
case 'css':$type = 'text/css';break;
case 'txt':$type = 'text/plain';break;
case 'js':$type = 'text/javascript';break;
case 'css':$type = 'text/css';break;
}
ob_start("ob_gzhandler");
ob_start("compress");
header("Content-type: $type charset: UTF-8");
header("Cache-Control: must-revalidate");
$off = 1800; # Set to a reaonable value later, say 3600 (1 hr);
$exp = "Expires: " . gmdate("D, d M Y H:i:s", time() + $off) . " GMT";
header($exp);
require_once($_GET['file']);
?>
And then, use it like this:
<link rel="stylesheet" type="text/css" href="gz.php?file=style.css" />
<script type="text/javascript" src="includes/jQuery/jquery-latest.pack.js"></script>
<script type="text/javascript" src="includes/thickbox/thickbox-compressed.js"></script>
If you noticed, you just have to add "gz.php?file=" before every file you add 
Hope I've been usefull
Similar Threads
-
By Joomlabuff in forum Other Software and Applications
Replies: 0
Last Post: 03-14-2009, 11:19 PM
-
By daubendeck in forum Shopping Carts
Replies: 3
Last Post: 12-07-2007, 05:53 AM
-
By soundhunter in forum General Joomla Discussions
Replies: 3
Last Post: 09-26-2007, 09:19 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Copyright © 2012 SiteGround.com Inc