Welcome Guest, Not a member yet? Register   Sign In
what $string = $this->load->view('myfile', '', true) exactly does?
#7

[eluser]mddd[/eluser]
Quote:In the above case
$this->load->view(‘my_view’,$data);
would work the same, right?
Yes.

Quote:How can the $string variable be used/proccessed/edited afterwards?
Could you show me a simple example?
It allows you to use views with more flexibility.
Suppose you want to create an email in html. You can write that email as a view. You load the view, while passing all the personalized information (as variables). Instead of outputting the view directly, you 'catch' it in the string and then send it with the Email library.

Or if you have an element that returns multiple times in your webpage. Like a list of restaurants or whatever. Probably a list of div's with all kinds of data inside. You could make a view called 'restaurant-item' and load that same view multiple times, once for each item in the list. Catch the output in an array and send that, along with other information, to a 'main view'. That way, the main view stays shorter and more easy to understand.


Messages In This Thread
what $string = $this->load->view('myfile', '', true) exactly does? - by El Forum - 08-20-2010, 04:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB