php Progress bar

ruicos

New Member
Messages
9
Reaction score
0
Points
0
I would like to create a progress bar in php. Do you know to do that?
 

Salvatos

Member
Prime Account
Messages
562
Reaction score
1
Points
18
You mean during a download? (I don't know how but I figure that info would help others help you. My guess is you have to use Flash to do that, though.)
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
If you want to make a moving progress bar for something, you have to use some client-side scripting (javascript, flash, w/e) but not php
 

nyanko

New Member
Messages
57
Reaction score
0
Points
0
Ajax + Php Still I dont know how to Im still trying to learn Ajax u_u
 

ruicos

New Member
Messages
9
Reaction score
0
Points
0
I want to run a php script. While the php script is running it would appear a progress bar. For example if i have a flash progress bar how can i call it from the php script?
 

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
As marshian said, you need to use only client side scripts.. You can try Ajax + php progress bar also.. google for it and you can find so many info about it.
 

Scoochi2

New Member
Messages
185
Reaction score
0
Points
0
BUT if the PHP script is running, nobody will be able to see the progress bar anyway.
You can show flash using the following:
Code:
echo "<object width='400' height='100'>
<param name='movie' value='flashbar.swf'>
<embed src='flashbar.swf' width='40' height='100'>
</embed></object>";
But understand that the bar will not be seen until PHP has finished execution. PHP is a server side only language. Everything is done on the server, and the client only sees the results.
 

sunils

New Member
Messages
2,266
Reaction score
0
Points
0
Using ajax you can do that.. you have uploaders with progress bar which uses ajax technology. It uses the php code to upload the code and simultaneously shows the progress bar.
 

nyanko

New Member
Messages
57
Reaction score
0
Points
0
as a tweak you can call the swf thing at the beginning of your php script, then clear it at the end.
 

marshian

New Member
Messages
526
Reaction score
9
Points
0
You can do something like...
when the php script starts, set a session variable to 0 (0%)
while the php script runs, change that number (0 -> 100%)
meanwhile, ANOTHER PAGE shows the progress bar
using javascript it requests a 3rd php page which returns the session variable
again using javascript, the scrollbar is updated.

Example (in my-code = non-existing language)

do-something-page.php
Code:
$_SESSION["prog"] = 0;
for(blahblah) {
$_SESSION["prog"]++;
}

pageThatIsCalledByJavascript.php
Code:
echo $_SESSION["prog"];

statusbarPage.php
Code:
<html blahblah>
<script>
ProgressBar status = new ProgressBar();
status.value = 0;
setTimeout(update, 1000);
function update() {
newstatus = getPageContents("pageThatIsCalledByJavascript.php");
status.value = newstatus;
}
</script>


<3 me-code ;p

- Marshian
 
Top