Output Buffer Module - Call this hook_alter_html

Events happening in the community are now at Drupal community events on www.drupal.org.
mikeytown2's picture

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

smk-ka's picture

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

mikeytown2's picture

Boost and Beautify both use the output buffer successfully, you might want to look into them ;) Edit: CSS Gzip and Parallel now as well.

Contributed Module Ideas

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: