Welcome Guest, Not a member yet? Register   Sign In
how to use a variable in controller?
#1

[eluser]girish[/eluser]
i used this:


$this->load->view('login', $data);


Can i take a variable $content or other.
which can hold the value of complete page.

for eg.

can i take login page in single variable and pass it to view.

I did pass the title, header etc but now i want to pass complete login page !!!

Is it possible? how?
#2

[eluser]Unknown[/eluser]
It's clearly stated in user guide... Wink

Quote:Returning views as data

There is a third optional parameter lets you change the behavior of the function so that it returns data as a string rather than sending it to your browser. This can be useful if you want to process the data in some way. If you set the parameter to true (boolean) it will return data. The default behavior is false, which sends it to your browser. Remember to assign it to a variable if you want the data returned:

Code:
$string = $this->load->view('myfile', '', true);

User guide - views


Then You can add
Code:
$string
to the next view as usual.




Theme © iAndrew 2016 - Forum software by © MyBB