output buffering question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

output buffering question

Post by d3ad1ysp0rk »

I'm assuming ob_ functions are what I'm going to need for this, but I'm stuck on exactly how to do it. I've been experimenting with ob_start(); ob_flush(); and stuff like that, but I just can't get my desired result :\

I want to have a type of loading thing, almost like

echo "processing";
insert into db blah blah blah
echo "calculating";
for($i=0;$i<$num;$i++){
$val = $val2*$val2 / 2 + $val;
}
echo "Done.";
echo "Value: " . $val;

it wont be really like that, but as a general thing, how would i go about doing that?
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

I've briefly tried to do similar things using PHPs ob_* functions but didn't succeed. So anyway, if anyone replies to this post and helps him out I would also benefit :)
Last edited by nigma on Sun Feb 29, 2004 12:00 pm, edited 1 time in total.
penguinboy
Forum Contributor
Posts: 171
Joined: Thu Nov 07, 2002 11:25 am

Post by penguinboy »

You can't do this with php.
Php is a server side language.
User avatar
devork
Forum Contributor
Posts: 213
Joined: Fri Aug 08, 2003 6:44 am
Location: p(h) developer's network

Post by devork »

i wanted to do this type of stuff with tables like
"loading data..." and ta da! it shows up.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

I would go about this using ob_start with a callback function.

Every time you ouput something that function gets called and you can increase the percentage of "loaded". But (and here lies the dead fox), you'll need to break the output buffering to display the percentage/output.

Do bear in mind that you can't "refresh" the screen from PHP.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Lil, take a look:
http://www.dnsstuff.com/tools/tracert.ch?ip=google.com
are you talking about something like that?

Check html source of that page.
Post Reply