473,394 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

loading screen

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
5 10294
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

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
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bill K | last post by:
I am developing a winforms project in vb.net. I have several forms that have a number of controls, grids, etc. When I load these as MDI child forms, they load slowly AND they paint/repaint on the...
17
by: Aguilar, James | last post by:
My previous example used the concept of a Shape class heirarchy, so I will continue with that. Suppose I have something like fifty different shapes, and I am trying to instantiate one of them. ...
6
by: Curious George | last post by:
I have a page that takes about 10 seconds to load the first time it is run. I would like to first display a little animated gif telling the user that the page is loading. How do I do this with...
8
by: Terry | last post by:
I am loading a javascript function from my asp.net app. This function loads a string passed to it in a new window. I register the function to activate on click of an asp linkbutton. Now when...
1
by: alex | last post by:
Hi, I am loading quite a large list into a datagrid and while doing so the form freezes... and for 10-20 seconds i have quite a messy screen. e.g. the file chooser half deleted and still half...
3
by: Maileen | last post by:
Hi, I have a module in which are define 2 forms as below : '------ Module Module1 Public MyMain As New FMain Public MySplash As New FSplash Public Sub Main() MySplash.Show()
0
by: vinayakk | last post by:
Hello webies, I have a problem with loading html pages in frameset. I am using location.href to load html pages one by one upon the user request and these pages in turn load flash files. When one...
8
by: Mark Shroyer | last post by:
I just completed a new design for a personal web site. After finishing the basic CSS stuff and double-checking it in Safari, FF, Opera, et al., I put on my war paint and fired up IE7 to figure out...
3
by: codyshea2000 | last post by:
how would i make text dissapear then the text on that page apears all on the same page i know how to make text dissapear like this <div id="helpdiv" style="display:block"> Loading... </div> ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.