• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using views: stop execution after loading a view but still get the layout


I want to do something like this:

try {
catch (\Exception $e) {

further code which is not executed

The problem is if I put an exit statement after loading the error view the layout is not loaded. But I if I don't then the rest of the code is executed.

How do I load a view and the layout and then stop?



You can return the whole view to your method in a string.

$error_view = $this->load->view('your_view', $data, TRUE);

The TRUE on the end tell's ci to return the view without displaying it...

After you do what you need to do you can then load that view.

Try return; instead of exit;

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.