Welcome Guest, Not a member yet? Register   Sign In
flush(); 'ing data in a view
#1

[eluser]Falney[/eluser]
Hi. I'm having a problem where I need to flush data in a view file to create a div based progress bar.

I need the script to do a lot of HTTPRequest's and I need some way to show people that the site isn't actually broken.

Unfortunately (And Im not 100% sure why though but I think I may know) flush(); doesn't seem to want to work. Here's a (very)basic test script I wrote up while trying to get it working;

Code:
<?PHP
ob_start();
echo 'Bounty<br>';
@ob_flush();
sleep(5);
echo 'Snickers<br>';
@ob_flush();
sleep(5);
echo 'Mars';
flush();

//END OF TEST VIEW

It's running the whole script and outputting it at once when it's finished processing.

I've tried using ob_get_contents() also. I'm just at a loss and feeling embarressed from it.

Please help.

Fal
#2

[eluser]jkevinburton[/eluser]
it doesn't work because you cannot use flush() as the whole output of views are buffered then spit out.
#3

[eluser]Falney[/eluser]
Can you suggest an alternative method? Or should I just flush an aditional view above the one doing the process with a message or repeating loading animation?

Edit~

Infact. I cant get flush to work in a controler either

Code:
ob_start();
$this->load->view('includes/headder');
ob_flush();
$this->load->view('syndicates/send', $results);
$this->load->view('includes/footer');




Theme © iAndrew 2016 - Forum software by © MyBB