Log in

View Full Version : How to Capture Output from print_output()


forgueam
10-13-2009, 03:42 PM
I'd very much like to do some post-processing of the output of print_output(), however, it is flushing its output to the connection.

I've attempted to turn on output buffering before my call to print_output, an then catch the output via ob_get_contents(), but the explicit flush() call inside of print_output() is making that method fail.

So, is there any other way to capture the output from print_output() into a variable before sending it to the browser?

Thanks!
Aaron

Lynne
10-13-2009, 03:46 PM
Instead of:
eval('print_output("' . fetch_template('your_template') . '");');

Do:
eval('$your_variable = "' . fetch_template('your_template') . '";');

forgueam
10-13-2009, 03:49 PM
Thanks Lynne,
Unfortunately I need to do processing on the final HTML, and print_output replaces variables that fetch_template does not.