Senin, 10 September 2018

Code Igniter, retrieving return value from view

You might need someday retrieving a return value from view. Well, I am glad that I finally knew it that it is possible.

So this is how we can do it.

The common usage of function to load a view is like this.

$this->load->view("myPage", $arrayOfData);


But if your view should return a value, then do this

$returnVal = $this->load->view("myPage", $arrayOfData, TRUE);

Yup, this function has a third parameter. If you set it as TRUE, than it will return the value, otherwise it will return CI Object.

Tidak ada komentar:

Posting Komentar