Bluehost.com Web Hosting $6.95

Wondering about a search page!

This is a discussion on Wondering about a search page! within the PHP Language forums, part of the PHP Programming Forums category; I have noticed that one like mysql.com when you do a search it takes you to a page that ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-26-2006
Extremest
 
Posts: n/a
Default Wondering about a search page!

I have noticed that one like mysql.com when you do a search it takes
you to a page that says your search is running then it loads up the
results on another page. How can I do this. I figured it would help
for any query that might take more than a couple seconds to have time
to run.

Reply With Quote
  #2 (permalink)  
Old 10-26-2006
Erwin Moller
 
Posts: n/a
Default Re: Wondering about a search page!

Extremest wrote:

> I have noticed that one like mysql.com when you do a search it takes
> you to a page that says your search is running then it loads up the
> results on another page. How can I do this. I figured it would help
> for any query that might take more than a couple seconds to have time
> to run.


i,

Are you talking about multiple windows (frames, Iframes, popupwindows) or
all in the same window?

If the former, use JavaScript to load an URL in some window. Or if you just
want to change one window that is different from the one where the click
happens, simple use the word target="windowname" in your hyperlink where
windowname is name of the window where you want to new page to be loaded.

If the latter, are we talking about a sign saying 'Just a few secs...' and
then loads the page in the same window?

I checked www.mysql.com but I didn't see the behaviour you mention, so be
more precice please. :-)

Regards,
Erwin Moller
Reply With Quote
  #3 (permalink)  
Old 10-26-2006
Extremest
 
Posts: n/a
Default Re: Wondering about a search page!

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/

Reply With Quote
  #4 (permalink)  
Old 10-26-2006
Erwin Moller
 
Posts: n/a
Default Re: Wondering about a search page!

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.displa y='none';
// make realpage visible
document.getElementById("pleasewait").style.displa y='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
Reply With Quote
  #5 (permalink)  
Old 10-27-2006
Extremest
 
Posts: n/a
Default Re: Wondering about a search page!

I did notice that the normal search at mysql does not do it only the
forum search does it for me.

I will see what I can do with what you have givin me though...Thanks a
lot for the help.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 12:22 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0