hi guys...
i am new to php ,so please help me out.
i have this page where i have to parse text files for data an then display it in a table.
this much i have done succesfully.now i want to add a 'please wait' or some loading gif image while this parsing is bieng done.
but i dnt know how to do it?
can somebody help me
how to display waiting message/image while parsing a file
Moderator: General Moderators
how to display waiting message/image while parsing a file
Last edited by mymykeviv on Tue Apr 28, 2009 2:20 am, edited 2 times in total.
Re: help?
Thanks for the help.Apollo wrote:See nr.7
Regarding your question, this may help:But it doesn't work everywhere (depends on server). Instead of flush, you can also try ob_flush, or both.Code: Select all
print('please wait'); flush();
It is working ,but for files which have less data .if the data is too much my loading images is displayed just for few seconds and then it is gone and after a few more seconds my populated table appears.
Re: help?
Also, as Apollo insinuated:
Forum Rules wrote: 2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
Re: help?
thanks for reminder...wont happen againastions wrote:Moved to PHP - Code
Also, as Apollo insinuated:Forum Rules wrote: 2. Use descriptive subjects when you start a new thread. Vague titles such as "Help!", "Why?" are misleading and keep you from receiving an answer to your question.
Re: how to display waiting message/image while parsing a fil
A demo:
The loadingPleaseWait div is a hidden overlay. When you click on the "Load Results Page" link, the "Loading, please wait..." message is visible until results-page.php returns something.
start-page.php
Note: The onload="hide_wait_msg()" in the body tag is unnecessary.
results-page.php
Bug: Because Firefox caches the Javascript state of pages, the start page will still show the wait message if you use the back button to return to it from the results page.
Edit: This post was recovered from search engine cache.
The loadingPleaseWait div is a hidden overlay. When you click on the "Load Results Page" link, the "Loading, please wait..." message is visible until results-page.php returns something.
start-page.php
Code: Select all
<html>
<head>
<title>Start Page</title>
<style type="text/css">
#loadingPleaseWait {
position: absolute; left: 0; top: 0;
width: 100%; height: 100%;
background-color: white;
display: none;
}
#loadingPleaseWait div {
margin-top: 10%;
text-align: center;
}
</style>
<script type="text/javascript">
function show_wait_msg ()
{
get('loadingPleaseWait').style.display = 'block';
}
function hide_wait_msg ()
{
get('loadingPleaseWait').style.display = 'none';
}
function get (id)
{
return document.getElementById(id);
}
</script>
</head>
<body onload="hide_wait_msg()">
<div id="loadingPleaseWait"><div>Loading, please wait...</div></div>
<p><a href="results-page.php" onclick="show_wait_msg()">Load Results Page</a></p>
</body>
</html>results-page.php
Code: Select all
<?php ob_start(); ?>
<html>
<head><title>Results Page</title></head>
<body>
<p>Loaded</p>
<?php sleep(5); /* Simulates work :) */ ?>
</body>
</html>
<?php ob_end_flush(); ?>Edit: This post was recovered from search engine cache.