Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please wait, page loading

Status
Not open for further replies.

skiflyer

Programmer
Sep 24, 2002
2,213
US
Ok, this is most likely a javascript question, but in the interest of not cross-posting, and also going to the place most likely to provide a solution...

I have a page which takes some time to load. It's taking the time because of a rather annoying shell_exec call... I want to say, Be patient, page is coming.

I figured a javascript popup of some sort would be best, but printing it to the page is just as fine by me.

Is there a good way to do this in either PHP or Javascript?

Echo/print is inneffective here.

-Rob
 
If you are like me and handier with a GIF animation than JavaScript, create a GIF animation that says 'One moment please...'. You can animate a progress bar. The last frame of the animation should be blank so by the time the page loads, the animated GIF seems to be gone.
 
This would imply I knew how long the page took to load, and that's exactly my problem, between a myriad of factors the page takes between 1 second and 20.

-Rob
 
in the interest of good web design - a warning should be displayed for the user before the shell_exec call. if it is the first page on the site, then it should be simple to write a bit of html that tells the user to be patient, if it is not the default page, a note by the link the that the user clicks that activates the shell_exec would be good.

why is echo/print innefective? curious...

 
Print/echo is ineffective because the output was being delayed until after the shell_exec finished anyway.

The page has frames, so the solution I went with was, before leaving for the page which calls shell_exec I make one frame a please wait message, then when the shell_exec page finishes it returns the frame to normal.

And sleipnir, this is back with my questionable shell_exec call, I doubt anyone would complain that it loaded at 20%, but that it stuck on 99% over and over would be problematic.

-Rob
 
echo 300 spaces and your buffers will clear. --BB
 
I have a program that generates PDF's, the process can take upto 30 minutes. I use this code:

function PDFGen($Creator = "", $Author = "", $Title = "", $FileName = "") {
global $isDone, $PDFs;
$this->_Obj = pdf_new();
if ($FileName == "") {
if (!pdf_open_file($this->_Obj, "")) {
die("Error creating PDF");
}
} else {
if (!pdf_open_file($this->_Obj, realpath("./cache/".$FileName))) {
die("Error creating PDF");
}
echo &quot;<HTML><BODY>Creating report, please wait...</BODY></HTML>&quot;;
echo str_repeat(&quot; &quot;, 300);
flush();
}
ob_start();
...SNIP...
}

function ShowPDF($force = false) {
$this->ClosePage();
pdf_close($this->_Obj);
$PDFs = &quot;&quot;;
$errs = ob_get_contents();
ob_end_clean();
if (!$this->_Debug) {
if (strlen(trim($errs)) > 0 && !$force) {
echo &quot;There has been an unexpected error<br>&quot;;
echo &quot;<hr>&quot;.$errs;
} elseif ($this->_FileName == &quot;&quot;) {
$buf = pdf_get_buffer($this->_Obj);
header(&quot;Content-Type: application/pdf&quot;);
header(&quot;Content-Length: &quot;.strlen($buf));
header(&quot;Content-Disposition: inline; filename=PDF.PDF&quot;);
echo $buf;
} else {
echo &quot;<script>location.href = './cache/&quot;.$this->_FileName.&quot;';</script>&quot;;
}
}
}
--BB
 
Just a note from your first post, a Javascript popup would probably be a bad idea because processing is stopped until they click OK, and then they're left looking at a blank screen still.
 
BB101,

Intriguing... for my own edification is 300 a scientifically determined number or was it done by trial and error?

-Rob

 
300 was a number recommended to me by somewhere else when I was experiencing the same problem as mentioned above! --BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top