Ok, I'm sure you guys have all seen the "loading page" search thing when you do a search here on phpbuilder (if you have, anyway. If not, go try it, you'll see what I'm talking about). It says this:

Your search is in progress and you will be taken to the results in a moment. Thank you for your patience.

I'd like to know how to do this for my web site. I have a script that runs that takes about 30 seconds for the script to finish executing. I'd like to have a loading page for this, but I have no clue where to even start. Any suggestions?

    I would also like to add that this is a "global" script. By that I mean that, there wouldn't be a loading page that was caused by a user's input. It would be a script that I would set up to run, say, a couple times a day. While the script is running, there would be a little bit of a wait period for ALL users. This is where the loading screen would need to take effect.

    Everything I've seen so far is an individual progress bar or something that's caused from user input, but wouldn't reflect the updating of the entire site for all users.

      It's a pretty simple mechanism actually. All you have to do is change the "action" of your form to your "loading screen" file and have the loading screen activate the script that actually does the work.

        Originally posted by sglane
        It's a pretty simple mechanism actually. All you have to do is change the "action" of your form to your "loading screen" file and have the loading screen activate the script that actually does the work.

        Ok. However, this isn't a script that gets run on a timed basis. Say, for example, at 10am and 10pm every day. So to call the post function to the script would activate it many, many times a day (potentially thousands). Also, this script needs to halt all processes through the entire site until it is complete.

        Maybe what you're saying would do this, but if so, I'm confused as to how it would work.

        I owe everybody here so much for all your help. Please don't stop! =)

          Ok, you are beginning to not make any sense to me. Is this script timed or not? You've posted :

          It would be a script that I would set up to run, say, a couple times a day.

          and later said

          However, this isn't a script that gets run on a timed basis

          Also, I don't quite understand why you want a loading screen. I don't know how you expect all the processes on the site stop and I don't understand why you would want that. Could you let us know exactly what you are trying to do?

          Some code examples would help...

            we have a script doing this at my work with asp..

            will I think its what you want.

            While its loadin a page/ or doing somthing show a progress bar or somthing then after loading show the real page..

            now in asp we use buffering..

            Response.Buffer = true

            now I just found that php can do this.. using ob_start

            http://www.php.net/manual/en/function.ob-start.php

            and we used

            Response.flush

            so in php its
            flush()

            http://www.php.net/manual/en/function.flush.php

            hope this may help

              Originally posted by sglane
              Ok, you are beginning to not make any sense to me. Is this script timed or not? You've posted :

              It would be a script that I would set up to run, say, a couple times a day.

              and later said

              However, this isn't a script that gets run on a timed basis

              Also, I don't quite understand why you want a loading screen. I don't know how you expect all the processes on the site stop and I don't understand why you would want that. Could you let us know exactly what you are trying to do?

              Some code examples would help...

              I'm sorry, let me try to explain this more clearly. I have a site that will run a script at certain times during the day. This script will affect everything on the entire site, so while it's running, I can't have any users making any queries. So, while all the users are waiting, I want there to be a loading page, telling them to wait a moment while the update finishes.

              I hope this makes more sense.

                Originally posted by DigitalExpl0it

                now I just found that php can do this.. using ob_start

                http://www.php.net/manual/en/function.ob-start.php

                hope this may help

                I looked at this, and I don't see how this would do what I am looking for. However... it very well may. I just don't understand exactly what the function is supposed to accomplish, even after reading everything and the comments on the first page.

                  I'm sorry, let me try to explain this more clearly. I have a site that will run a script at certain times during the day. This script will affect everything on the entire site, so while it's running, I can't have any users making any queries. So, while all the users are waiting, I want there to be a loading page, telling them to wait a moment while the update finishes.

                  You could wrap a conditional around your entire website.

                  if (isset($sitebeingupdated)) {

                  echo "<html><body>\n";

                  echo "<meta http-equiv=\"refresh\" content=\"60;URL=\"".$_SERVER['SCRIPT_NAME']."\"";

                  echo "The website is being updated at this time. Please check back in 5 minutes.</body></html>";

                  } else {

                  // display site normally

                  }

                    Just a thought........Why does it matter? When I update a site, people can be viewing it, its called CACHE. As soon as they reload the page they will view the updates and nothing will be disrupted.

                    Just a thought, though,

                    -D

                      Write a Reply...