Tuesday, April 9, 2013

How to return view’s as data in Codeigniter?

View’s can be returned as data with a third parameter ( setting to TRUE) as follows

   $output = $this->load->view('view', $data, TRUE);

You can use this option for many purposes. I have used it for constructing downloads and to grab and print complete html template. You can used it to build PDFs with the help of some custom libraries or function.

1 comment: