Welcome Guest, Not a member yet? Register   Sign In
Output Buffering.. White Screen Before Page Display

I've been using CI for a few months now and I'm curious to know if anyone else has experienced this:

When I display a page with a lot of content, the screen is blank and then the view shows up all at once. It's as if the output is buffering until everything in the page has been loaded on the PHP side.

Is there a way to stop this?

Yes CI uses output buffering. I *think* the only workaround is to do:
echo $this->load->view('the_view_file', '', TRUE);

However, if you notice it, I think your pages take way to long to generate. I'd look into using CI's page caching as well, so it's only the first time that would be slow. From then on it will just load the cached file until the cache time expires.

Another way would be to extend the loader class and override the _ci_load() method, and remove the output buffering. However, that could also have other side affects like if you are setting headers or something. CI outputs the headers first and then outputs the buffer. I think the *better* way would be to optimize your app so it loads faster. It could be optimizing queries, adding indexes to the database on columns you are selecting on, ordering by, etc.

Theme © iAndrew 2016 - Forum software by © MyBB