Jump to content


Photo

Progress bar dependant on page


  • Please log in to reply
6 replies to this topic

#1 Thierry

Thierry
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts
  • LocationNetherlands

Posted 18 August 2006 - 06:29 PM

I'm trying to make a progress bar that fills up as the page is loading.
I can do this with a bunch of set variables, but then, in total disregard of how long the page might take to load, it will always take the same amount of time.
What I need is that the bar goes from 0% at the start to 100% when the page has completed loading, whether that takes 1 second or 30 seconds.
So that would mean that if the page will take longer to load (say a heavy search query) the progress bar will fill up more slowly accordingly (like with your browser).
Is there any PHP (or javascript) function/value that can help me with this?

Currently I can only make it last for the same amount of time using a loop and then a flush.
Have you tried....a reset?

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 18 August 2006 - 07:46 PM

you could fork your script or do what everyone else does and just have an animated gif without any % loading.  The user is really only interested in teh fact that the browser isn't hanging so the gif still working away will satisfy them enough.
follow me on twitter @PHPsycho

#3 Thierry

Thierry
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts
  • LocationNetherlands

Posted 20 August 2006 - 04:16 PM

Thats probably true, but I still want to be able to do this.
Basicly all I need is some kind of value which I can use to modify the amount of time for the bar to fill up.
(basicly some kind of indication of how long it might take to load the current page).
Have you tried....a reset?

#4 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 20 August 2006 - 04:20 PM

To do a progress bar you have to know one of two things:  the total time the script will take to execute before it executes, so you can then take the time elapsed and compare it to the time needed and give a percentage...or you need a way to measure the progress of the script, so if the script has finished 20% of itself, then you let the user know that.

#5 Thierry

Thierry
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts
  • LocationNetherlands

Posted 20 August 2006 - 04:49 PM

Any ideas on how I can figure out how long any given script is going to take? If I for instance do a search on something that yields a lot of results, then naturally the bar should fill up slower.
Any javascript or PHP value or function that can calculate the total time of the execution?
Have you tried....a reset?

#6 Thierry

Thierry
  • Members
  • PipPipPip
  • Advanced Member
  • 85 posts
  • LocationNetherlands

Posted 23 August 2006 - 04:41 PM

Anything else then PHP javascript that can be used? Something from the system itself? (like starting a word application or something). The browser loading bar does seem dependant on page loading time so there must be something.
Have you tried....a reset?

#7 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 23 August 2006 - 09:13 PM

The browser loading bar does seem dependant on page loading time so there must be something.


That's because it knows how much data is in/on the page...it's a part of the packet information.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users