By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,302 Members | 1,812 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,302 IT Pros & Developers. It's quick & easy.

loading screen

P: n/a
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

T
Oct 25 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
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.

Oct 25 '06 #2

P: n/a

Laurent Haan wrote:
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.
How about an animated gif.. but really.. do users want to see a loading
screen??

Flamer.

Oct 25 '06 #3

P: n/a
"Laurent Haan" <la**********@gmail.compíse v diskusním príspevku
news:11**********************@f16g2000cwb.googlegr oups.com...
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.
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
this:

<html>
<head>
<script>
function resizeit(x) {
image=getElemtById("bar");
image.width=x;
}
</script>
</head>
<body>
Loading: <img id="bar" src="some_green_image.gif" height=10 width=1>
<p>...some long html content here</p>
<script>resizeit(5)</script>
<p>...some other long html content here</p>
<script>resizeit(10)</script>
....
<script>resizeit(100)</script>

--

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

P: n/a
Laurent Haan wrote:
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.
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"
This effect can't be realised by only using PHP...
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.

http://usphp.com/manual/en/function.ob-end-clean.php

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

http://us2.php.net/manual/en/functio...t-contents.php

Oct 26 '06 #5

P: n/a
toffee wrote:
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 ?
Redirection with delay, take a look at the header() function documentation,
this can also be done with meta tags in pure html too.

http://www.php.net/manual/en/function.header.php
//Aho
Oct 26 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.