![]() |
CI and flushing output question - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: CI and flushing output question (/showthread.php?tid=22149) |
CI and flushing output question - El Forum - 08-31-2009 [eluser]btray77[/eluser] I've been trying to do something very simple and I cannot get it to work. I want to flush the output while i've got a process working. I'm going though hundreds of database records and file, and want to display a "*" when I finish each one. I've looked into : ob_end_flush(); ob_start(); ob_flush(); flush(); Below is a sample function I made to display the working, progress... can someone give me working sample of how to display output without getting stuck in the buffer? Code: function working( $char = null) I was guessing something like below, but it doesn't work: Code: function go () CI and flushing output question - El Forum - 09-29-2009 [eluser]skunkbad[/eluser] your ob_flush is lacking () CI and flushing output question - El Forum - 09-29-2009 [eluser]btray77[/eluser] Thanks I had given up on that... I'll try it again now. -Brad CI and flushing output question - El Forum - 09-29-2009 [eluser]skunkbad[/eluser] also, working() is not a php function. You might just use echo. CI and flushing output question - El Forum - 09-29-2009 [eluser]btray77[/eluser] Look above working was a function I gave source to above.... Working was what was to send the output out so that people were not staring at a blank screen for 3 minutes wondering if this is working or not.. -Brad CI and flushing output question - El Forum - 09-29-2009 [eluser]John_Betong[/eluser] [quote author="btray77" date="1254288189"]Look above working was a function I gave source to above.... Working was what was to send the output out so that people were not staring at a blank screen for 3 minutes wondering if this is working or not.. -Brad[/quote] If and only if, maybe you are using the code in a function then the working function requires to be called as follows: Code: $this->working('?'); Also in your function working(...) you can supply a $char default of '*' and this will make the following line redundant: Code: if (! $char) $char = '*'; Also if function working is in the same controller and is not being called from anywhere else then it is beneficial to prefix it with an underscore denoting that the function is within the same controller. edit: added also and another also. |