Page 1 of 1

How do I show a progress-bar?

Posted: Fri Oct 15, 2004 5:25 am
by lotty
Hey,

I have searched google and also read a few books on php now.

Im getting frustarted and ready to start learning a diffrent lanuage.

I am trying to make a progress bar my php script is carrying out a lengthy task.

I have came across html progress as a pear package.

Will this do the job?

Posted: Fri Oct 15, 2004 5:37 am
by patrikG
Edited your title to something more meaningful than "progress" and moved your post to the "Client-Side" forum.

Posted: Fri Oct 15, 2004 5:40 am
by kettle_drum
I would use a mixture of javascript and php in an iframe. Have the javascript resize the lenght of the completed section by reloading the iframe to see how far the php script is coming along.

Posted: Fri Oct 15, 2004 6:01 am
by mudkicker
kettle_drum wrote:I would use a mixture of javascript and php in an iframe. Have the javascript resize the lenght of the completed section by reloading the iframe to see how far the php script is coming along.
isnt't it an un-optimized thing? i think it overloads the server too much? and even the internet connection of user.. :roll: or am i wrong? tell me please kettle :)

Posted: Fri Oct 15, 2004 6:05 am
by m3mn0n
Isn't the one in the bottom of your browser sufficient?

Or do you want this to be on the webpage as some sort of indication of the size of your folder, compared to the limit?

Please clarify.

Posted: Fri Oct 15, 2004 6:18 am
by kettle_drum
mudkicker: Yeah of course it is! But if you have to show one thats probably the more accurate method. If it was my project i wouldnt use a real progress bar, but simply an animated gif to show some kind of loading process and then put under "Please Wait".

If its a lenghty process then users should be aware that it will take time, and dont need to see a % scale of the current process. Or depending on what the script does, im sure some of it could be done before the user presses a button - so see what you can get a cron script to run every so often and then you have some of the data processed already.

Posted: Fri Oct 15, 2004 6:25 am
by lotty
there is also flush(), like I have said I am a newbie to php so if this is absolutey crazy then well got to learn somehow.

I can get it to flush() and using ob_flush() at the same time problem is it needs to be to be a fair amount of characters.

A loop looping the text loading 50 times onto the screen seems a bit much. Would it be possible to buffer a transparent gif with one line of text?

Posted: Fri Oct 15, 2004 6:32 am
by phpScott
if you are going to use Iframes then when you submit the form you can just set the src of an image tag to load the animated gif, which is what I will be doing because of some server intesive graphic creation I will have my current project doing. I have also seen this technique used on some other graphic producing sites especially if there will be lots of users.

Posted: Fri Oct 15, 2004 7:05 am
by mudkicker
kettle_drum wrote:mudkicker: Yeah of course it is! But if you have to show one thats probably the more accurate method. If it was my project i wouldnt use a real progress bar, but simply an animated gif to show some kind of loading process and then put under "Please Wait".
Yes, this is the way I always do it. I think it's the easiest & best one.

Posted: Fri Oct 15, 2004 8:07 am
by lotty
First time in this hideout.

Lots of replys and diffrent views.

Weird you ask 5 coders how to do one thing you get 14 diffrent answers.

Thanks guys.

I will be in here more often.

I managed to get a simple buffer to work and print please wait, which is a start to what i want to achive.

Posted: Fri Oct 15, 2004 10:02 am
by phpScott
that's the great nature about programming.
So many options, so little time.

Posted: Fri Oct 15, 2004 1:04 pm
by kettle_drum
And also the joy of php - you can achieve the same result in 20 different ways.