Tutorialsplane

Codeigniter Return View as Data String


Codeigniter return view as data string : You can return view as string data in codeigniter

Codeigniter return view as data string Example


$string = $this->load->view('my_view',true);

if the second parameter is set true it will return the complete(including html) data as string.
if it set false it will output the result to the browser.

Codeigniter return view as data string Example

<?php defined('BASEPATH') OR exit('No direct script access allowed');

class MyBlog extends CI_Controller {

public function index(){

 $string1 = $this-?>load->view('my_view1',true);
 $string2 = $this->load->view('my_view2',true);
 $string3 = $this->load->view('my_view3',true);
 $string4 = $this->load->view('my_view4',true);

  // process the above string as you wish.

}
}   
?>                    

Models

Connect Database

Helpers

Libraries

Helper Reference

Library Reference

Database Reference