How do I show a progress-bar?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
lotty
Forum Newbie
Posts: 3
Joined: Thu Oct 14, 2004 3:25 pm

How do I show a progress-bar?

Post 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?
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Edited your title to something more meaningful than "progress" and moved your post to the "Client-Side" forum.
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post 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.
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post 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 :)
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post 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.
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post 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.
lotty
Forum Newbie
Posts: 3
Joined: Thu Oct 14, 2004 3:25 pm

Post 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?
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post 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.
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post 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.
lotty
Forum Newbie
Posts: 3
Joined: Thu Oct 14, 2004 3:25 pm

Post 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.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

that's the great nature about programming.
So many options, so little time.
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

And also the joy of php - you can achieve the same result in 20 different ways.
Post Reply