Welcome Guest, Not a member yet? Register   Sign In
Output to a View from a Hook
#1

[eluser]Phantom784[/eluser]
I want to capture anything that's echoed inside of a controller (e.g. debug statements), and incorporate this in a certain area on the output. I have a pair of hooks set up. A 'pre_controller' hook turns output buffering on, and a 'post_controller' hook dumps the output into a string. I want to make this string available to whatever view is loaded. I can't just put it in $data['buffered_output'], since this has already been sent in the controller. I also tried using a global variable, but the view couldn't access it. What would be the best way to make this data available.

I know it'd probably be easier to just add everything to a $debug variable or something like that in the controller, but pretty much everyone working on the project we're moving to CI is in the habit of echoing debug data, and I'd like to not just have this tossed up at the very top of every HTML document (I also plan to hide it from non-developers).




Theme © iAndrew 2016 - Forum software by © MyBB