Redirect vs $this->load->view |
[eluser]123wesweat[/eluser]
In general when do you use redirect('', location) and when $this->load->view('', $data)?? regards
[eluser]ciGR[/eluser]
The $this->load->view use when you have a call to a page,then the steps are run the code of the corresponding controller and load the appropriate view to display the results. you can see the flow chart Quote:http://ellislab.com/codeigniter/user-gui...pflow.htmlThe redirect you can use when you have to redirect the user to another page(with this you call another controller). For example I use redirect when I have a controller&view;to show a form to edit a post , with url /posts/3/edit and when the user save-submit the form, I redirect again to the edit page to see the changes, or to the root directory /posts to see all the posts. So the load->view loads a view from a controller(or from a view) but with redirect loads an(redirect to) other page, that means another controller which maybe load a view. |
Welcome Guest, Not a member yet? Register Sign In |