[eluser]Unknown[/eluser]
I have a very large CI app that we’ve been developing for about 6 months. I love the simplicity and flexibility of CI and have had a lot of success. I wouldn’t call myself a CI expert, but I’m very familiar.
I’m refactoring some common controllers into a core controller to simplify my codebase. In doing so, I’ve come across a very strange problem.
The load view function will not work, but ONLY in this instance. The two calls I have below are in a core controller and are called from throughout the application - and they work 100% of the time, except in my new controller. They’re all being called via a parent::render function (since they’re all based on extended controllers).
In any case, if I run this line of code from my new controller, nothing happens:
Code:
$this->load->view("templates/header", $data);
But the bizarre thing to me is that if I run this instead, it works perfectly.
Code:
echo $this->load->view("templates/header", $data, TRUE);
It’s true that I could just change all my load view functions to echo the data from the view, but that seems sloppy and I’m sure someone else has had this bug, but I was not able to find a way to fix this in the forum.
It seems likely to me that this is a problem with my new controller code, but it seems really strange to me that it would work with one way (via echoing the view data) but not the other (just executing the view function) since they should be equivalent function calls…
Any ideas would be appreciated.