Page 1 of 1

showing something till it gets loaded...

Posted: Sat Jun 12, 2004 11:42 am
by psmshankar
I'm using the DevText
( http://www.developershed.com/devtext.php )
in my home page.
Bcos of n/w unstability, my home page takes time to load as it connects to devshed to get the details..
How to by-pass this and flush all the other details - all the other contents are just html in my page - and then let that takes its own time to display..

till that time i shud show something in that area.. like 'Loading..'

any idea?

Posted: Sat Jun 12, 2004 12:47 pm
by feyd
flush()... but that only works on some servers...

alternately, you could place the devtext in an iframe...

Posted: Sat Jun 12, 2004 1:10 pm
by psmshankar
does iframe supported by all browser versions?

Posted: Sat Jun 12, 2004 1:17 pm
by tim
no.

Posted: Sat Jun 12, 2004 1:34 pm
by feyd
mozilla/netscape/ie support it.. some other may, I don't quite know.

Posted: Mon Jun 14, 2004 7:08 am
by Weirdan
when it comes to 'Please wait, loading....' I usually use this snippet:

Code: Select all

echo "<div id='loading_div' style='display:none'> Loading, please wait.... </div>";
echo <<<EOF
<script language="Javascript" type="text/javascript">
load_div = document.getElementById('loading_div');
content_div = document.getElementById('content_div');
content_div.style.display = 'none';
load_div.style.display = 'block';
</script>
EOF;
flush();
echo "<div id='content_div'>";
echo " CONTENT GOES HERE ";
echo " EVEN MORE CONTENT ";
echo "</div>";
echo <<<EOF
<script language="Javascript" type="text/javascript">
load_div.style.display = 'none';
content_div.style.display = 'block';
</script>
EOF;
flush();

Posted: Mon Jun 14, 2004 7:15 am
by patrikG
[php_man]ob_start[/php_man]() and related functions might also be of interest.