rfox Posted March 27, 2007 Share Posted March 27, 2007 I basically have text displayed on the screen saying processing . . . Would be cool if I could say processing *pause 1 second* .*pause 1 second* .*pause 1 second* . <?php sleep(1) ?>. <?php sleep(1) ?>. <?php sleep(1) ?>. I thought would display a . then wait 1 second. Rather then that, it simple doesn't display anything for 3 seconds, then everything is shoved on the screen at once. How do I get that to work ??? Link to comment https://forums.phpfreaks.com/topic/44434-similar-to-sleep/ Share on other sites More sharing options...
hitman6003 Posted March 27, 2007 Share Posted March 27, 2007 Use javascript. If you use php you will have to have the user refresh the page (or the page auto refresh)...and refreshing every 1 second will confuse the user. Unless you are using CLI php....... Link to comment https://forums.phpfreaks.com/topic/44434-similar-to-sleep/#findComment-215805 Share on other sites More sharing options...
rfox Posted March 27, 2007 Author Share Posted March 27, 2007 javascript cool. can you link me a tutorial, google isnt helping me much but it's probably my search phrases Link to comment https://forums.phpfreaks.com/topic/44434-similar-to-sleep/#findComment-215807 Share on other sites More sharing options...
pcbytes Posted March 27, 2007 Share Posted March 27, 2007 you can do this... ;D Let me know if it works for ya! <?php function printdot(){ sleep(1); print "."; ob_flush(); flush(); } for($i=0; $i<3; $i++) { printdot(); } ?> Link to comment https://forums.phpfreaks.com/topic/44434-similar-to-sleep/#findComment-215811 Share on other sites More sharing options...
rfox Posted March 27, 2007 Author Share Posted March 27, 2007 hey pcbytes, thanks, but not quite. It times the first dot, and the last 2 dots up come at the same time, so it just looks like a laggy website haha. Also, while its printing out the dots, it doesn't load the rest of the site. So you cant see the bottom half of the website (All the code past the print dot) I was looking at w3schools, but I could do with some help with javascript if possible, I am very... VERY bad @ javascript.. help would be awsome! <script type="text/javascript"> var i=0 function timer(){ while (i<=3){ var t=setTimeout("document.write(' .')", 1000) i=i+1 } } </script> Link to comment https://forums.phpfreaks.com/topic/44434-similar-to-sleep/#findComment-215837 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.