Posted by mikeytown2 on September 2, 2009 at 7:52am
Create a module that can be leveraged by other modules (via hook) that uses the output buffer; pass by reference; print at end, write to core page cache if enabled. Make http://sourceforge.net/projects/simplehtmldom/ or another package a required download in the libraries dir, allowing other modules to leverage this inside their hook.
Modules that could benefit:
Boost, Beautify, Parallel, CSS Gzip
Thoughts?

Comments
D7 only
AFAIK, this can't be properly done in D6 due to the cache system, which interferes with hook_boot/hook_exit: the order during bootstrapping is 1. cache starts its output buffer 2. in your hook_boot() implementation you would start your own output buffer. However, in drupal_page_footer() the order is reversed: the cache system is called first (instead of hook_exit()), which returns the result as string and clears(!) the output buffer, leaving you with no output to process further.
In D7 the order seems to be corrected (hook_boot/hook_exit are now called after the cache system has been initialized/before the cache system stores the output), which would make it possible to capture the full page output.
I learned this while working on a nofollow/link juice sculpturer leveraging Matt Butcher's excellent QueryPath library, before Google decided to dismissed nofollow usage ;)
--
Stefan Kudwien
unleashed mind
-Stefan
Works in D6
Boost and Beautify both use the output buffer successfully, you might want to look into them ;) Edit: CSS Gzip and Parallel now as well.