loading screen

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi all,

I've seen a really cool effect which i would like to use on an intranet
site. Am referring to the 'LOADING..' animation you see when switching
pages. I've seen it somewhere on a website that was using php (cant remember
the url). I've tried googling but came up with nothing - so does anyone know
what function of php allows to display a little animation while a sql query
is being run ?

Many thanks


Re: loading screen

This effect can't be realised by only using PHP, since PHP is a
server-side language and the loading screen appears client side.
Yet, it is possible to achieve such an effect by using javascript and
CSS and having php invoke the necessary functions to enable/disable the
loading screen.

What you need to do is design the loading screen in css and hide it
initially. As soon as you start the section in php where the loading
screen is ment for, you send the html code to the client that invokes
the javascript function that displays the loading screen. Finally, at
the end of the php script, you send the invokation to the javascript
function that hides the loading screen again.

I hope this helps.

Re: loading screen

Laurent Haan wrote:

Quoted text here. Click to load it

How about an animated gif.. but really.. do users want to see a loading


Re: loading screen

Quoted text here. Click to load it
Other way is to place small image eg. 10x1 pixel to page and into very long  
html content time by time put javascript for resizing image width. Some like  

function resizeit(x) {
Loading: <img id="bar" src="some_green_image.gif" height=10 width=1>
<p>...some long html content here</p>
<p>...some other long html content here</p>


Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail  
from another non-spammer site please.)

Re: loading screen

Laurent Haan wrote:

Quoted text here. Click to load it

This won't work because PHP is server-side and javascript is
client-side. NONE of the client-side js code will be executed on the
browser until all of the PHP code has executed. Basically, you won't
get a "loading" message until the job is already "loaded"

Quoted text here. Click to load it

That is not entirely true. You can make use of the php output buffer.
Keep in mind this is only a viable option when you're running multiple
PHP commands iteratively. For instance, say you're running a series of
PHP queries, such as inserting a master record which returns some
result details, then inserting records into multiple child tables, each
having some sort of result detail returned.

You can append the *result detail* stuff to the output buffer, while
echoing out the approximate change in percent completed. Once all the
SQL tasks are completed, you then dump out the buffer. This is
especially useful for transactional queries where everything rolls back
if something fails. The first link below has a pretty good example.




Re: loading screen

toffee wrote:
Quoted text here. Click to load it

Redirection with delay, take a look at the header() function documentation,  
this can also be done with meta tags in pure html too.



Site Timeline