views:

21

answers:

1

Would the following code in a controller prevent the nextFunction() from running?

$this->load->view('foo');
nextFunction();
+1  A: 

Ostensibly, that seems to be the case. Apparently, CI will combine calls to multiple views into one response, so that you can assemble a page (response) from multiple pieces. However, that doesn't mean that it returns control to the controller.

You can have the call to load return that processed view as a string. That has to allow you to do further processing in the controller.

e.g.

$foo_string = $this->load->view('foo', '', false);
nextFunction();

This would require that you echo $foo_string yourself, so that it's displayed in the browser.

See "Returning views as data" at the very bottom of this page, in the CI user guide.

George Marian