pre-loader

Discussion in 'Javascript' started by Brian, Nov 16, 2006.

  1. Brian

    Brian Guest

    Hi there

    I'm not sure if this is a PHP or a Javascript problem, so sorry for the
    cross post

    I have a PHP page that talks to a MySQL page, i want to put in a "loading"
    message.
    I have tied to use a layer and using a showlayer at the top of the page and
    hide
    at the bottom, but it does not work, it still waits for the PHP to run.

    I know it can be done, as i have seen it, how do they do that?

    Brian
    Brian, Nov 16, 2006
    #1
    1. Advertising

  2. On Thu, 16 Nov 2006 22:40:08 GMT, "Brian" <> wrote:

    >Hi there
    >
    >I'm not sure if this is a PHP or a Javascript problem, so sorry for the
    >cross post
    >
    >I have a PHP page that talks to a MySQL page, i want to put in a "loading"
    >message.
    >I have tied to use a layer and using a showlayer at the top of the page and
    >hide
    >at the bottom, but it does not work, it still waits for the PHP to run.
    >
    >I know it can be done, as i have seen it, how do they do that?


    It seems like you're on the right track.

    A common reason why it won't work is if you have mod_gzip enabled. You
    can disable mod_gzip for a specific folder by having this in your
    ..htaccess

    <IfModule mod_gzip.c>
    mod_gzip_on Off
    </IfModule>

    You can see an example I made for a loading screen here:
    http://siteloom.dk/~martin/loading/

    --
    best regards,
    Martin Mouritzen.
    http://www.siteloom.dk
    Martin Mouritzen, Nov 17, 2006
    #2
    1. Advertising

  3. Brian

    J.O. Aho Guest

    Martin Mouritzen wrote:
    > On Thu, 16 Nov 2006 22:40:08 GMT, "Brian" <> wrote:
    >
    >> Hi there
    >>
    >> I'm not sure if this is a PHP or a Javascript problem, so sorry for the
    >> cross post
    >>
    >> I have a PHP page that talks to a MySQL page, i want to put in a "loading"
    >> message.
    >> I have tied to use a layer and using a showlayer at the top of the page and
    >> hide
    >> at the bottom, but it does not work, it still waits for the PHP to run.
    >>
    >> I know it can be done, as i have seen it, how do they do that?

    >
    > It seems like you're on the right track.
    >
    > A common reason why it won't work is if you have mod_gzip enabled. You
    > can disable mod_gzip for a specific folder by having this in your
    > .htaccess
    >
    > <IfModule mod_gzip.c>
    > mod_gzip_on Off
    > </IfModule>
    >
    > You can see an example I made for a loading screen here:
    > http://siteloom.dk/~martin/loading/


    usage of mod_gzip is quite small nowadays and I don't think it's the problem
    but the flushing of the output buffer in php.

    Use ob_flush() to get out the data you want

    <?php
    /* header stuff and such */
    ....
    /* head of HTML */
    ....
    /* div for the waiting message */
    ....
    /* javascript to enable div */
    ....
    ob_flush();
    /* do what you need to do with the mysql */
    ....
    /* generate the rest of the page */
    ....
    ob_end_flush();
    ?>

    That could work for you, but I won't guarantee it will.


    //Aho
    J.O. Aho, Nov 17, 2006
    #3
  4. Brian

    Brian Guest

    "J.O. Aho" <> wrote in message
    news:...
    > Martin Mouritzen wrote:
    >> On Thu, 16 Nov 2006 22:40:08 GMT, "Brian" <> wrote:
    >>
    >>> Hi there
    >>>
    >>> I'm not sure if this is a PHP or a Javascript problem, so sorry for the
    >>> cross post
    >>>
    >>> I have a PHP page that talks to a MySQL page, i want to put in a
    >>> "loading" message.
    >>> I have tied to use a layer and using a showlayer at the top of the page
    >>> and hide
    >>> at the bottom, but it does not work, it still waits for the PHP to run.
    >>>
    >>> I know it can be done, as i have seen it, how do they do that?

    >>
    >> It seems like you're on the right track.
    >>
    >> A common reason why it won't work is if you have mod_gzip enabled. You
    >> can disable mod_gzip for a specific folder by having this in your
    >> .htaccess
    >>
    >> <IfModule mod_gzip.c>
    >> mod_gzip_on Off
    >> </IfModule>
    >>
    >> You can see an example I made for a loading screen here:
    >> http://siteloom.dk/~martin/loading/

    >
    > usage of mod_gzip is quite small nowadays and I don't think it's the
    > problem but the flushing of the output buffer in php.
    >
    > Use ob_flush() to get out the data you want
    >
    > <?php
    > /* header stuff and such */
    > ...
    > /* head of HTML */
    > ...
    > /* div for the waiting message */
    > ...
    > /* javascript to enable div */
    > ...
    > ob_flush();
    > /* do what you need to do with the mysql */
    > ...
    > /* generate the rest of the page */
    > ...
    > ob_end_flush();
    > ?>
    >
    > That could work for you, but I won't guarantee it will.
    >
    >
    > //Aho




    Thanks for your help guys, i will have a play and see what happens :)

    Brian
    Brian, Nov 21, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rocky Moore
    Replies:
    7
    Views:
    1,717
    mikeb
    Jan 14, 2004
  2. =?Utf-8?B?S2V2aW4gQnVydG9u?=

    Pre-Send Request Headers, Pre-Send Request Content

    =?Utf-8?B?S2V2aW4gQnVydG9u?=, Dec 31, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,029
    =?Utf-8?B?S2V2aW4gQnVydG9u?=
    Dec 31, 2004
  3. Wladimir Borsov
    Replies:
    7
    Views:
    463
    Raymond Loman
    May 5, 2004
  4. Karsten Wutzke
    Replies:
    0
    Views:
    379
    Karsten Wutzke
    Jun 29, 2007
  5. Juha Nieminen
    Replies:
    3
    Views:
    1,129
    Juha Nieminen
    Feb 22, 2008
Loading...

Share This Page