Firefox PHP

Tidy Output

Posted by Brian Moon 
All files from this thread

File Name File Size   Posted by Date  
mod_tidy.php 1.4 KB open | download Brian Moon 10/29/2007 Read message
Tidy Output
June 08, 2007 01:37AM
This is a simple little module that I wrote based on some work I have done at dealnews to save some bytes here and there. We mainly use it to save bytes in our cache, but it saves bandwidth. For the forum list on this page, it saves 8k of just junk that is not needed for a browser to render the page.

Update: New version that does not kill pre and xmp tags. This version is included in the 5.2 code as of now.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter



Edited 1 time(s). Last edit at 10/29/2007 12:48AM by brianlmoon.
Attachments:
open | download - mod_tidy.php (1.4 KB)
Re: Tidy Output
July 23, 2007 05:50PM
FYI...
when I enabled this module in a forum where I have:
<?php ob_start("ob_gzhandler"); ?>

it produces an error (instead of output) in firefox. It seemed to work just fine in IE and Safari, so I dont think it's an issue on the server.. but it does seem odd.
Re: Tidy Output
October 29, 2007 12:49AM
See if the new version works for you. It uses output buffering and should not get messed up with ob_gzhandler as long as ob_gzhandler is called very very early in the code. Like, it should be the first thing called.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: Tidy Output
October 29, 2007 03:10AM
Quote
brianlmoon
See if the new version works for you. It uses output buffering and should not get messed up with ob_gzhandler as long as ob_gzhandler is called very very early in the code. Like, it should be the first thing called.

It's the VERY first thing called... and in firefox it provides a blank page.

I tried in in safari (on a pc) and got this:
Safari can’t open the page “[www.MYPHORUM.com]”. The error was: “unknown error” (CFURLErrorDomain:-1011) Please choose Report Bugs to Apple from the Help menu, note the error number, and describe what you did before you saw this message.


I'll just assume it's some other module causing a problem. for now, I'm just going to keep it off.
Re: Tidy Output
October 29, 2007 01:17PM
honestly, if you are using ob_gzhandler, this module is not really useful anyway. gz will cut out the empty space when it compresses.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: Tidy Output
November 07, 2007 02:37AM
Quote
brianlmoon
honestly, if you are using ob_gzhandler, this module is not really useful anyway. gz will cut out the empty space when it compresses.
yes, but only with browsers which support gzipped data, so it's still a niceity, but it might be more of a resource saving to just run a tidy on the templates and call it a day, if my phorums got more traffic I'd stress over it, but no ones really complained about speed and bandwidth hasn't beena problem.
Re: Tidy Output
November 07, 2007 05:20AM
show me the browser not supporting gzipped data and being widely used ;).


Thomas Seifert
Re: Tidy Output
December 06, 2007 01:29PM
I was using this module until I discovered an unintended? side effect:

When editing or previewing a message that has "code", all of the extra whitespace is stripped out in the new edit box. Leading spaces, as well as spaces in the middle.

this
   is                                                 <- this gets shifted over as well
     the
        sort of thing
     I'm
   talking
about

Disabling the module solves the problem, but perhaps there is another fix?
Re: Tidy Output
December 06, 2007 01:30PM
current 5.2.3 should have the fix included already.


Thomas Seifert
LAj
Re: Tidy Output
May 01, 2008 03:53PM
So, is safe to use this module and ob_gzhandler?
Sorry, only registered users may post in this forum.

Click here to login