Reply to Re: Wondering about a search page!

Your name:

Reply:


Posted by Erwin Moller on 10/26/06 13:42

Extremest wrote:

> I'm sorry I mean all on one page. Here is the forum for mysql that i
> am talking about. If you put something in the search at the top there
> it will do what I am talking about.
> http://forums.mysql.com/

Hi,

Hmm, I still don't see it happen. :-/
Everything happens at once when I search.

Anyway,
You have a long process and want to say 'stand by please....' to your
visitor in the meantime. Right?
AFAIK the only way to do this (nicely) via JavaScript, which can be
disabled.
At the bottom I propose a way that is less nice to see, but works even if JS
is disabled.

** If you know your visitor has JS enabled **

1) Before you start the long process, send a partial HTML file to the
client. call ob_start() before you create output. This starts the buffering
of the output.
eg:
<headerstuff and doctype here>
<body onLoad="showPage();">
<div id="pleasewait" style="display:block">
<h1>Please wait, I am very busy</h1>
</div>

<div id="realpage" style="display:none">

2) Call ob_flush(). This will make sure (sort of) that the content created
so far is send to the visitor.
--> Start your processing here and produce output as you want to. <--
3) End with:

</div>

<script type="text/javascript">
function showPage(){
// make pleasewait invisible
document.getElementById("pleasewait").style.display='none';
// make realpage visible
document.getElementById("pleasewait").style.display='block';
}
</script>

</body>
</html>

Not tested, so forgive typos, but that is the idea.
Only use this solution is you are sure your visitor has JS enabled,
otherwise they will be stuck with 'pleasewait' untill their power runs out.

** No JS **
A more reliable way, that does not depend on JS being enabled is simple, but
less elegant because the pleasewait will never disappear. Like this:
1) Call ob_start()
<headerstuff and doctype here>
<body>
<h1>Please wait, I am very busy</h1>

2) Call ob_flush()
3) do calcs and produce output.


Regards,
Erwin Moller

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация