Can I pass data to the Codeigniter output class without displaying it? Can I pass data to the Codeigniter output class without displaying it? codeigniter codeigniter

Can I pass data to the Codeigniter output class without displaying it?


...so - do I understand correctly - you want to get the whole final output (not just the view) as a string AND not display it to the user? Why dont you just overload the controllers _output() function?

class Your_controller extends CI_Controller{       function stuff()       {           // do whatever - prep $data etc           $this->load->view('your_view', $data);       }       function _output($output)       {           // send $output to your library - get results blah blah           $result_pdf_file = $this->your_pdf_library_generator($output);           // Show something else to the user           echo "hi - I'm not what you expected - but here is your PDF";           echo $result_pdf_file; // or something like that       } }

This means you can send ANYTHING you like to the output class - but nothing is displayed except what you want.

There are ways to improve this idea (i.e. hooks, variables to turn output on/off etc) - but the simplest would be to have this controller specifically for your pdf_generation command.

I don't see any way of doing step 2 based on the output class documentation. Is it possible to get a view into the output class without displaying it? If so, how? I'm using CI 2.0.3.

The controller _output() documentation is actually in the CI controller documentation, which is why it eluded you.